4
votes

I'm trying to setup a queue on Apollo 1.6 that will be written to from PHP using STOMP and consumed by Java using the ActiveMQ openwire client.

I can read and write to my queue from Java, I can read and write to it from PHP, and I can write messages with Java and read them with PHP, but I cannot write messages from PHP and read them with Java which is what I really want to do.

When I look at the queue using Apollo's admin UI I can see all the messages I post with PHP/STOMP and with Java/ActiveMQ in the test queue I have created. The codec for the php messages is stomp and for the java messages it is openwire. My php client reads both types of messages, but my java client does not read the stomp ones.

Here is a gist with a distilled example:

  • Apollo.java reads and writes to test queue
  • send.php writes to test queue
  • recv.php reads from test queue
  • apollo.xml is the apollo configuration used to set up the test queue.

I printed out the StompFrames received by php, the first was posted by java/openwire, the second by php/stomp:

➜  stomp-php-1.0.0  php -f recv.php
Received from /queue/test:
StompFrame Object
(
    [command] => MESSAGE
    [headers] => Array
        (
            [destination] =>
            [content-length] => 256
            [content-type] => protocol/openwire
            [message-id] => demo-71
        )

    [body] =>�{/ID:uspdxml-drevel.local-57993-1378699215106-1:1dtestn{/ID:uspdxml-drevel.local-57993-1378699215106-1:1A�O
hello!
)
➜  stomp-php-1.0.0  php -f send.php
➜  stomp-php-1.0.0  php -f recv.php
Received from /queue/test:
StompFrame Object
(
    [command] => MESSAGE
    [headers] => Array
        (
            [message-id] => demo-81
            [destination] =>  /queue/test
        )

    [body] => world
)
1

1 Answers

2
votes

Apache Apollo is not built to auto convert messages depending on the consumer protocol of choice. The key to understand this is that Apollo was built to be the core of the next generation ActiveMQ. The broad feature set, such as implicit conversions and other "nice to have" features are left to be implemented once/if the Apollo project is merged with ActiveMQ.

From my perspective you have three alternatives:

  1. Use Stomp in java.
  2. Switch to ActiveMQ (probably painless, but with a performance penalty)
  3. Do some manual conversion - like using Apache Camel to feed of the stomp queue and produce to the JMS/OpenWire queue.