Fixed BlazeDS code and got Flex receiving/sending messages to FioranoMQ

Wow I’m proud of myself today! So I had this problem where my generic Flex ‘chat’ client was able to SEND JMS messages to FioranoMQ but not RECEIVE them. After days of reviewing my configuration and my code, I realized the problem wasn’t with me, it was with BlazeDS. So I downloaded the BlazeDS source code, did some investigation, and “fixed” the problem.

What I did:

I found out that within the BlazeDS source code, the outgoing ‘Message’ objects had null ‘message ids’ and this was throwing an exception that was never handled. The method where the problem originated was called “pushMessageToClient” in the class “”. This method was passed a Message object, and the method basically cloned the given message in order to send it to each client (to keep each message to each client unique). My analysis revealed that the message that was passed to this method had a null message id, and therefore, each cloned message had a null message id as well. After cloning the original message, the method “pushMessageToClient” called a method “routeMessageToMessageClient” and this is where the exception was thrown. At the beginning of the “routeMessageToMessageClient” method, the code checked to see if the message had a unique id, and if it did not, a “MessageException” was thrown. This exception was propagated back to the “pushMessageToClient” method but was there was no code to handle the exception. In other words, the exception was definitely caught, but no log entries were written so this is why the Tomcat server did not know what was going on. Anyways, it turns out that the BlazeDS developers had commented out a line of code within the method “pushMessageToClient” which, by default, assigned a ‘message id’ to outgoing messages. They might have done this because they assumed that the cloning process would ensure an assigned message id; however, in my particular case, the original message itself had no message id! I still need to investigate why this was the case, but uncommenting this line (and including the proper import) fixed the problem and made sure that, by default, a unique message id is always assigned to the outgoing message.

The source files in question:

    • contains method “pushMessageToClient”
    • contains method “getMessageBroker”
  • flex.messaging.MessageBroker
    • contains method “routeMessageToMessageClient”

The solution:

  • Uncomment line ~629 in method pushMessageToClient within class
    • message.setMessageId(UUIDUtils.createUUID());
  • Include UUIDUtils import in
    • import flex.messaging.util.UUIDUtils;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s