Avatar

Level 2
Hello,



I need some clues about how LCDS work with JMS messaging.

I've setup a j2ee application which use a JMS queue on my
weblogic server. I have a message driver bean to catch messages and
dispatch it to other class to update some data. Everything work
fine.



What I want to do is build a flex UI to monitoring JMS
message that come on my queue for testing purpose.

So I setup a flex application with live cycle data and
configure end point to connect to my queue using rtmp.



What am I facing now is that I am not receiving any message
from my queue but when I send some data from the flex UI my MDB is
catching it correctly.



So my questions are :



  • Do I need to go throw my MDB and add this code on the
    onMessage() method ? :

    MessageService msgService = (MessageService)service;

    msgService.pushMessageToClients(message, true);

    msgService.sendPushMessageFromPeer(message, true);


  • flex.messaging.services.messaging.adapters.JMSAdapter should
    not have this role to notify client on messages coming instead
    usind a MDB



    Here the code I'm usinf for the flex UI. It's pretty simple :



quote:



<?xml version="1.0" encoding="utf-8"?>

<mx:Application creationComplete="consumer.subscribe();"
xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns:comp="components.*" layout="absolute"
viewSourceURL="srcview/index.html">

<mx:Script>

<![CDATA[

import mx.messaging.*;

import mx.messaging.messages.*;

import mx.messaging.events.*;

private function messageHandler(event:MessageEvent):void {

// Handle message event.

msgTxt.text = "Message received";

msgTxt.text = event.toString();

}

private function
acknowledgeHandler(event:MessageAckEvent):void{

// Handle message event.

msgTxt.text = event.acknowledgeMessage.toString();

}

private function faultHandler(event:MessageFaultEvent):void
{

// Handle fault event.

msgTxt.text = event.faultString.toString();

}

private function sendMessage():void {

var message:AsyncMessage = new AsyncMessage();

message.body = userName.text + ": " + msg.text;

producer.send(message);

}

]]>

</mx:Script>

<mx:Consumer id="consumer" destination="onjJMS"

message="messageHandler(event)"

fault="faultHandler(event)"/>

<mx:Producer id="producer" destination="onjJMS"

acknowledge="acknowledgeHandler(event)"

fault="faultHandler(event)"/>



<mx:VBox x="0" y="0" height="100%" width="100%">

<mx:Label text="Message received" color="#fe9301"
fontWeight="bold"/>

<mx:TextArea width="100%" height="100%" id="msgTxt"/>

<mx:Label text="User" color="#fe9301"
fontWeight="bold"/>

<mx:TextInput id="userName" width="100%"/>

<mx:Label text="Message" color="#fe9301"
fontWeight="bold"/>

<mx:TextInput id="msg" width="100%"/>

<mx:Button label="Send" click="sendMessage()"/>

</mx:VBox>



</mx:Application>



And here it is my messaging-config.xml


quote:



<?xml version="1.0" encoding="UTF-8"?>

<service id="message-service"

class="flex.messaging.services.MessageService">



<adapters>

<adapter-definition id="actionscript"
class="flex.messaging.services.messaging.adapters.ActionScriptAdapter"
default="true" />

<adapter-definition id="jms"
class="flex.messaging.services.messaging.adapters.JMSAdapter"/>

</adapters>



<destination id="onjJMS">



<adapter ref="jms"/>



<properties>



<jms>

<destination-type>Queue</destination-type>


<message-type>javax.jms.ObjectMessage</message-type>


<connection-factory>java:comp/env/jms/QCF</connection-factory>


<destination-jndi-name>java:comp/env/jms/ONJQUEUE</destination-jndi-name>


<destination-name>SimpleMessageBean</destination-name>

<delivery-mode>NON_PERSISTENT</delivery-mode>


<message-priority>DEFAULT_PRIORITY</message-priority>


<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>

<transacted-sessions>false</transacted-sessions>

</jms>



<network>

<session-timeout>0</session-timeout>

<throttle-inbound policy="ERROR" max-frequency="50"/>

<throttle-outbound policy="REPLACE"
max-frequency="500"/>

</network>



<server>

<max-cache-size>1000</max-cache-size>

<message-time-to-live>0</message-time-to-live>

<durable>true</durable>

<durable-store-manager>

flex.messaging.durability.FileStoreManager

</durable-store-manager>

</server>

</properties>



<channels>

<channel ref="my-rtmp"/>

<channel ref="my-polling-amf"/>

</channels>

</destination>



</service>





Regard's