Expand my Community achievements bar.

JMS messages sometimes not received by Flex client

Avatar

Level 1
We have a problem that Flex client is sometimes not able to
receive JMS messages from a JBoss JMS Queue. Most of the time it
works, but if users logout/login using the same account frequently
or you restart JBoss 4.0.4 during their session then it might
happen. Then it doesn't work at all even if you wait. Client is
able to send messages when this problem occurs, which can then be
intercepted by other clients but cannot receive any messages from
himself or from the others. JBoss 4.0.4 is running in cluster mode.
Could it be that there is an old frozen session which is receiving
the messages meant for the new client?(consumer selector is unique
to each user, but if a user logs in twice, the same selector is
used) If I run 2 instances of my JMS test consumer using the same
selector then the consumer which registered later receives the
messages and if it quits, then the older consumer starts receving
them. This doesn't occur in Flex.

Flex is running on Tomcat 5.5.17.



Our messaging-config.xml is



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

<service id="message-service"

class="flex.messaging.services.MessageService"

messageTypes="flex.messaging.messages.AsyncMessage">



<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="JMSQueueB">

<properties>

<network>

<session-timeout>10</session-timeout>

</network>

<jms>

<initial-context-environment>

<property>

<name>java.naming.factory.url.pkgs</name>


<value>org.jboss.naming:org.jnp.interfaces</value>

</property>

<property>

<name>Context.PROVIDER_URL</name>


<value>jnp://x.x.x.x:1100,jnp://x.x.x.y:1100</value>

</property>

<property>

<name>Context.INITIAL_CONTEXT_FACTORY</name>


<value>org.jnp.interfaces.NamingContextFactory</value>

</property>

</initial-context-environment>

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


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


<connection-factory>ConnectionFactory</connection-factory>


<destination-jndi-name>queue/B</destination-jndi-name>

<destination-name>B</destination-name>

<delivery-mode>PERSISTENT</delivery-mode>


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


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

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

</jms>

</properties>

<channels>

<channel ref="my-rtmp"/>

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

</channels>

<adapter ref="jms"/>

</destination>

</service>





Part of our actionscript code:



pmConsumer = new Consumer();

pmConsumer.destination = "JMSQueueB";

pmConsumer.selector = "some jms selector ....";

pmConsumer.addEventListener(MessageEvent.MESSAGE,
presenceMessageHandler);

pmConsumer.addEventListener(MessageFaultEvent.FAULT,
faultHandler);

pmConsumer.addEventListener(ChannelFaultEvent.FAULT,
channelFaultHandler);

pmConsumer.subscribe();



Also Flex seems to be handing channel switching incorrectly,
if rtmp port is firewalled, it won't use amf properly even though
it was given 2 channels in configuration file and JMS messaging
doesn't work. We have to alter the channel set during runtime.



Flex also doesn't automatically switch to other JMS server if
one goes down. Is this a feature or a bug? We have to reset
producer and consumer in order for this to work.

0 Replies