Trying to send and receive text messages using ActiveMQ with JavaScript (AMQP) and Java (OpenWire/JMS) clients

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Trying to send and receive text messages using ActiveMQ with JavaScript (AMQP) and Java (OpenWire/JMS) clients

Jeroen van Ooststroom
I have a simple test JavaScript (Node.js) client that connects to
ActiveMQ using AMQP and our Java client that connects to the same
ActiveMQ using OpenWire (JMS). When I send a message from the JavaScript
client (just a simple “Hello World!”) it is received by the Java client
as a javax.jms.BytesMessage. However the contents of this BytesMessage
contains a bunch of bytes in front of the actual “Hello World!” message:

    “SpESsESw�                                                      
    Hello World!”

I'm using the ActiveMQ's (5.13.4) and Qpid's suggested Rhea JavaScript
(Node.js) library for the simple JavaScript client for testing. On the
Java-side of things I'm using plain JMS 1.0.

The Rhea example I'm using is basically according to this sample:
https://github.com/grs/rhea/blob/master/examples/helloworld.js

I'm using the default AMQP configuration in order to enable the protocol
in activemq.xml:

    <transportConnector name="amqp"
    uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>

When I try to add "&transport.transformer=jms" or
"&transport.transformer=raw" the JavaScript client is unable to connect
anymore.

How do I get it so that it only contains the “Hello World!” message? Do
I need to parse out the bytes contained in the BytesMessage?

Thanks,
Jeroen...

Reply | Threaded
Open this post in threaded view
|

Re: Trying to send and receive text messages using ActiveMQ with JavaScript (AMQP) and Java (OpenWire/JMS) clients

tabish121@gmail.com
On 02/13/2018 05:29 PM, Jeroen van Ooststroom wrote:

> I have a simple test JavaScript (Node.js) client that connects to
> ActiveMQ using AMQP and our Java client that connects to the same
> ActiveMQ using OpenWire (JMS). When I send a message from the
> JavaScript client (just a simple “Hello World!”) it is received by the
> Java client as a javax.jms.BytesMessage. However the contents of this
> BytesMessage contains a bunch of bytes in front of the actual “Hello
> World!” message:
>
>    “SpESsESw�
>    Hello World!”
>
> I'm using the ActiveMQ's (5.13.4) and Qpid's suggested Rhea JavaScript
> (Node.js) library for the simple JavaScript client for testing. On the
> Java-side of things I'm using plain JMS 1.0.
>
> The Rhea example I'm using is basically according to this sample:
> https://github.com/grs/rhea/blob/master/examples/helloworld.js
>
> I'm using the default AMQP configuration in order to enable the
> protocol in activemq.xml:
>
>    <transportConnector name="amqp"
> uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
>
> When I try to add "&transport.transformer=jms" or
> "&transport.transformer=raw" the JavaScript client is unable to
> connect anymore.
>
> How do I get it so that it only contains the “Hello World!” message?
> Do I need to parse out the bytes contained in the BytesMessage?
>
> Thanks,
> Jeroen...
>
>
Try upgrading to ActiveMQ 5.15.3 which will have improved AMQP support
over that older version.

--
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/

Reply | Threaded
Open this post in threaded view
|

Re: Trying to send and receive text messages using ActiveMQ with JavaScript (AMQP) and Java (OpenWire/JMS) clients

Jeroen van Ooststroom
Thank you for your response.

When I upgrade to ActiveMQ 5.15.3 my simple JavaScript client isn't able
to connect to the AMQP connector anymore:

    error on read: ProtocolError: SASL layer not enabled
    (buffer:0x41,0x4d,0x51,0x50,0x03,0x01,0x00,0x00)

I'm not familiar with this. Does this mean I require a SASL client now
with a username/password to authenticate?
(https://github.com/grs/rhea/blob/master/examples/sasl/simple_sasl_client.js)
If so, I assume this affects the way the Java client connects as well?

Thanks,
Jeroen...

On 13/02/2018 23:45, Timothy Bish wrote:

> On 02/13/2018 05:29 PM, Jeroen van Ooststroom wrote:
>> I have a simple test JavaScript (Node.js) client that connects to
>> ActiveMQ using AMQP and our Java client that connects to the same
>> ActiveMQ using OpenWire (JMS). When I send a message from the
>> JavaScript client (just a simple “Hello World!”) it is received by
>> the Java client as a javax.jms.BytesMessage. However the contents of
>> this BytesMessage contains a bunch of bytes in front of the actual
>> “Hello World!” message:
>>
>>    “SpESsESw�
>>    Hello World!”
>>
>> I'm using the ActiveMQ's (5.13.4) and Qpid's suggested Rhea
>> JavaScript (Node.js) library for the simple JavaScript client for
>> testing. On the Java-side of things I'm using plain JMS 1.0.
>>
>> The Rhea example I'm using is basically according to this sample:
>> https://github.com/grs/rhea/blob/master/examples/helloworld.js
>>
>> I'm using the default AMQP configuration in order to enable the
>> protocol in activemq.xml:
>>
>>    <transportConnector name="amqp"
>> uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
>>
>>
>> When I try to add "&transport.transformer=jms" or
>> "&transport.transformer=raw" the JavaScript client is unable to
>> connect anymore.
>>
>> How do I get it so that it only contains the “Hello World!” message?
>> Do I need to parse out the bytes contained in the BytesMessage?
>>
>> Thanks,
>> Jeroen...
>>
>>
> Try upgrading to ActiveMQ 5.15.3 which will have improved AMQP support
> over that older version.
>

Reply | Threaded
Open this post in threaded view
|

Re: Trying to send and receive text messages using ActiveMQ with JavaScript (AMQP) and Java (OpenWire/JMS) clients

tabish121@gmail.com
On 02/13/2018 06:22 PM, Jeroen van Ooststroom wrote:

>
> Thank you for your response.
>
> When I upgrade to ActiveMQ 5.15.3 my simple JavaScript client isn't
> able to connect to the AMQP connector anymore:
>
>     error on read: ProtocolError: SASL layer not enabled
>     (buffer:0x41,0x4d,0x51,0x50,0x03,0x01,0x00,0x00)
>
> I'm not familiar with this. Does this mean I require a SASL client now
> with a username/password to authenticate?
> (https://github.com/grs/rhea/blob/master/examples/sasl/simple_sasl_client.js)
> If so, I assume this affects the way the Java client connects as well?
>
> Thanks,
> Jeroen...
>
> On 13/02/2018 23:45, Timothy Bish wrote:
>> On 02/13/2018 05:29 PM, Jeroen van Ooststroom wrote:
>>> I have a simple test JavaScript (Node.js) client that connects to
>>> ActiveMQ using AMQP and our Java client that connects to the same
>>> ActiveMQ using OpenWire (JMS). When I send a message from the
>>> JavaScript client (just a simple “Hello World!”) it is received by
>>> the Java client as a javax.jms.BytesMessage. However the contents of
>>> this BytesMessage contains a bunch of bytes in front of the actual
>>> “Hello World!” message:
>>>
>>>    “SpESsESw�
>>>    Hello World!”
>>>
>>> I'm using the ActiveMQ's (5.13.4) and Qpid's suggested Rhea
>>> JavaScript (Node.js) library for the simple JavaScript client for
>>> testing. On the Java-side of things I'm using plain JMS 1.0.
>>>
>>> The Rhea example I'm using is basically according to this sample:
>>> https://github.com/grs/rhea/blob/master/examples/helloworld.js
>>>
>>> I'm using the default AMQP configuration in order to enable the
>>> protocol in activemq.xml:
>>>
>>>    <transportConnector name="amqp"
>>> uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
>>>
>>>
>>> When I try to add "&transport.transformer=jms" or
>>> "&transport.transformer=raw" the JavaScript client is unable to
>>> connect anymore.
>>>
>>> How do I get it so that it only contains the “Hello World!” message?
>>> Do I need to parse out the bytes contained in the BytesMessage?
>>>
>>> Thanks,
>>> Jeroen...
>>>
>>>
>> Try upgrading to ActiveMQ 5.15.3 which will have improved AMQP
>> support over that older version.
>>
>
Yes, you need to either connect via SASL or configure the
transportConnector to accept non-SASL connections if you have not
secured your broker (you really should secure your broker).

wireFormat.allowNonSaslConnections=true

--
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/

Reply | Threaded
Open this post in threaded view
|

Re: Trying to send and receive text messages using ActiveMQ with JavaScript (AMQP) and Java (OpenWire/JMS) clients

Jeroen van Ooststroom
I added the wireFormat.allowNonSaslConnections=true to the AMQP
transport connector configuration which resolves the issue of the
JavaScript client not being able to connect anymore, but I still get the
same kind of BytesMessage at the Java-side as mentioned in the original
post with the added bytes before the "Hello World!" string.


On 14/02/2018 00:46, Timothy Bish wrote:

> On 02/13/2018 06:22 PM, Jeroen van Ooststroom wrote:
>>
>> Thank you for your response.
>>
>> When I upgrade to ActiveMQ 5.15.3 my simple JavaScript client isn't
>> able to connect to the AMQP connector anymore:
>>
>>     error on read: ProtocolError: SASL layer not enabled
>>     (buffer:0x41,0x4d,0x51,0x50,0x03,0x01,0x00,0x00)
>>
>> I'm not familiar with this. Does this mean I require a SASL client
>> now with a username/password to authenticate?
>> (https://github.com/grs/rhea/blob/master/examples/sasl/simple_sasl_client.js)
>> If so, I assume this affects the way the Java client connects as well?
>>
>> Thanks,
>> Jeroen...
>>
>> On 13/02/2018 23:45, Timothy Bish wrote:
>>> On 02/13/2018 05:29 PM, Jeroen van Ooststroom wrote:
>>>> I have a simple test JavaScript (Node.js) client that connects to
>>>> ActiveMQ using AMQP and our Java client that connects to the same
>>>> ActiveMQ using OpenWire (JMS). When I send a message from the
>>>> JavaScript client (just a simple “Hello World!”) it is received by
>>>> the Java client as a javax.jms.BytesMessage. However the contents
>>>> of this BytesMessage contains a bunch of bytes in front of the
>>>> actual “Hello World!” message:
>>>>
>>>>    “SpESsESw�
>>>>    Hello World!”
>>>>
>>>> I'm using the ActiveMQ's (5.13.4) and Qpid's suggested Rhea
>>>> JavaScript (Node.js) library for the simple JavaScript client for
>>>> testing. On the Java-side of things I'm using plain JMS 1.0.
>>>>
>>>> The Rhea example I'm using is basically according to this sample:
>>>> https://github.com/grs/rhea/blob/master/examples/helloworld.js
>>>>
>>>> I'm using the default AMQP configuration in order to enable the
>>>> protocol in activemq.xml:
>>>>
>>>>    <transportConnector name="amqp"
>>>> uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
>>>>
>>>>
>>>> When I try to add "&transport.transformer=jms" or
>>>> "&transport.transformer=raw" the JavaScript client is unable to
>>>> connect anymore.
>>>>
>>>> How do I get it so that it only contains the “Hello World!”
>>>> message? Do I need to parse out the bytes contained in the
>>>> BytesMessage?
>>>>
>>>> Thanks,
>>>> Jeroen...
>>>>
>>>>
>>> Try upgrading to ActiveMQ 5.15.3 which will have improved AMQP
>>> support over that older version.
>>>
>>
> Yes, you need to either connect via SASL or configure the
> transportConnector to accept non-SASL connections if you have not
> secured your broker (you really should secure your broker).
>
> wireFormat.allowNonSaslConnections=true
> --
> Tim Bish
> twitter: @tabish121
> blog:http://timbish.blogspot.com/

Reply | Threaded
Open this post in threaded view
|

Re: Trying to send and receive text messages using ActiveMQ with JavaScript (AMQP) and Java (OpenWire/JMS) clients

tabish121@gmail.com
On 02/13/2018 07:29 PM, Jeroen van Ooststroom wrote:

>
> I added the wireFormat.allowNonSaslConnections=true to the AMQP
> transport connector configuration which resolves the issue of the
> JavaScript client not being able to connect anymore, but I still get
> the same kind of BytesMessage at the Java-side as mentioned in the
> original post with the added bytes before the "Hello World!" string.
>
>
> On 14/02/2018 00:46, Timothy Bish wrote:
>> On 02/13/2018 06:22 PM, Jeroen van Ooststroom wrote:
>>>
>>> Thank you for your response.
>>>
>>> When I upgrade to ActiveMQ 5.15.3 my simple JavaScript client isn't
>>> able to connect to the AMQP connector anymore:
>>>
>>>     error on read: ProtocolError: SASL layer not enabled
>>>     (buffer:0x41,0x4d,0x51,0x50,0x03,0x01,0x00,0x00)
>>>
>>> I'm not familiar with this. Does this mean I require a SASL client
>>> now with a username/password to authenticate?
>>> (https://github.com/grs/rhea/blob/master/examples/sasl/simple_sasl_client.js)
>>> If so, I assume this affects the way the Java client connects as well?
>>>
>>> Thanks,
>>> Jeroen...
>>>
>>> On 13/02/2018 23:45, Timothy Bish wrote:
>>>> On 02/13/2018 05:29 PM, Jeroen van Ooststroom wrote:
>>>>> I have a simple test JavaScript (Node.js) client that connects to
>>>>> ActiveMQ using AMQP and our Java client that connects to the same
>>>>> ActiveMQ using OpenWire (JMS). When I send a message from the
>>>>> JavaScript client (just a simple “Hello World!”) it is received by
>>>>> the Java client as a javax.jms.BytesMessage. However the contents
>>>>> of this BytesMessage contains a bunch of bytes in front of the
>>>>> actual “Hello World!” message:
>>>>>
>>>>>    “SpESsESw�
>>>>>    Hello World!”
>>>>>
>>>>> I'm using the ActiveMQ's (5.13.4) and Qpid's suggested Rhea
>>>>> JavaScript (Node.js) library for the simple JavaScript client for
>>>>> testing. On the Java-side of things I'm using plain JMS 1.0.
>>>>>
>>>>> The Rhea example I'm using is basically according to this sample:
>>>>> https://github.com/grs/rhea/blob/master/examples/helloworld.js
>>>>>
>>>>> I'm using the default AMQP configuration in order to enable the
>>>>> protocol in activemq.xml:
>>>>>
>>>>>    <transportConnector name="amqp"
>>>>> uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
>>>>>
>>>>>
>>>>> When I try to add "&transport.transformer=jms" or
>>>>> "&transport.transformer=raw" the JavaScript client is unable to
>>>>> connect anymore.
>>>>>
>>>>> How do I get it so that it only contains the “Hello World!”
>>>>> message? Do I need to parse out the bytes contained in the
>>>>> BytesMessage?
>>>>>
>>>>> Thanks,
>>>>> Jeroen...
>>>>>
>>>>>
>>>> Try upgrading to ActiveMQ 5.15.3 which will have improved AMQP
>>>> support over that older version.
>>>>
>>>
>> Yes, you need to either connect via SASL or configure the
>> transportConnector to accept non-SASL connections if you have not
>> secured your broker (you really should secure your broker).
>>
>> wireFormat.allowNonSaslConnections=true
>> --
>> Tim Bish
>> twitter: @tabish121
>> blog:http://timbish.blogspot.com/
>
Now you need to switch to the JMS transformer to achieve cross protocol
messaging.

--
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/

Reply | Threaded
Open this post in threaded view
|

Re: Trying to send and receive text messages using ActiveMQ with JavaScript (AMQP) and Java (OpenWire/JMS) clients

Tim Bain
See the Mapping To JMS section of http://activemq.apache.org/amqp.html for
details.

(The other) Tim

On Feb 13, 2018 6:54 PM, "Timothy Bish" <[hidden email]> wrote:

> On 02/13/2018 07:29 PM, Jeroen van Ooststroom wrote:
>
>>
>> I added the wireFormat.allowNonSaslConnections=true to the AMQP
>> transport connector configuration which resolves the issue of the
>> JavaScript client not being able to connect anymore, but I still get the
>> same kind of BytesMessage at the Java-side as mentioned in the original
>> post with the added bytes before the "Hello World!" string.
>>
>>
>> On 14/02/2018 00:46, Timothy Bish wrote:
>>
>>> On 02/13/2018 06:22 PM, Jeroen van Ooststroom wrote:
>>>
>>>>
>>>> Thank you for your response.
>>>>
>>>> When I upgrade to ActiveMQ 5.15.3 my simple JavaScript client isn't
>>>> able to connect to the AMQP connector anymore:
>>>>
>>>>     error on read: ProtocolError: SASL layer not enabled
>>>>     (buffer:0x41,0x4d,0x51,0x50,0x03,0x01,0x00,0x00)
>>>>
>>>> I'm not familiar with this. Does this mean I require a SASL client now
>>>> with a username/password to authenticate? (
>>>> https://github.com/grs/rhea/blob/master/examples/sasl/simpl
>>>> e_sasl_client.js) If so, I assume this affects the way the Java client
>>>> connects as well?
>>>>
>>>> Thanks,
>>>> Jeroen...
>>>>
>>>> On 13/02/2018 23:45, Timothy Bish wrote:
>>>>
>>>>> On 02/13/2018 05:29 PM, Jeroen van Ooststroom wrote:
>>>>>
>>>>>> I have a simple test JavaScript (Node.js) client that connects to
>>>>>> ActiveMQ using AMQP and our Java client that connects to the same ActiveMQ
>>>>>> using OpenWire (JMS). When I send a message from the JavaScript client
>>>>>> (just a simple “Hello World!”) it is received by the Java client as a
>>>>>> javax.jms.BytesMessage. However the contents of this BytesMessage contains
>>>>>> a bunch of bytes in front of the actual “Hello World!” message:
>>>>>>
>>>>>>    “SpESsESw�
>>>>>>    Hello World!”
>>>>>>
>>>>>> I'm using the ActiveMQ's (5.13.4) and Qpid's suggested Rhea
>>>>>> JavaScript (Node.js) library for the simple JavaScript client for testing.
>>>>>> On the Java-side of things I'm using plain JMS 1.0.
>>>>>>
>>>>>> The Rhea example I'm using is basically according to this sample:
>>>>>> https://github.com/grs/rhea/blob/master/examples/helloworld.js
>>>>>>
>>>>>> I'm using the default AMQP configuration in order to enable the
>>>>>> protocol in activemq.xml:
>>>>>>
>>>>>>    <transportConnector name="amqp"
>>>>>> uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFor
>>>>>> mat.maxFrameSize=104857600"/>
>>>>>>
>>>>>> When I try to add "&transport.transformer=jms" or
>>>>>> "&transport.transformer=raw" the JavaScript client is unable to connect
>>>>>> anymore.
>>>>>>
>>>>>> How do I get it so that it only contains the “Hello World!” message?
>>>>>> Do I need to parse out the bytes contained in the BytesMessage?
>>>>>>
>>>>>> Thanks,
>>>>>> Jeroen...
>>>>>>
>>>>>>
>>>>>> Try upgrading to ActiveMQ 5.15.3 which will have improved AMQP
>>>>> support over that older version.
>>>>>
>>>>>
>>>> Yes, you need to either connect via SASL or configure the
>>> transportConnector to accept non-SASL connections if you have not secured
>>> your broker (you really should secure your broker).
>>>
>>> wireFormat.allowNonSaslConnections=true
>>> --
>>> Tim Bish
>>> twitter: @tabish121
>>> blog:http://timbish.blogspot.com/
>>>
>>
>> Now you need to switch to the JMS transformer to achieve cross protocol
> messaging.
>
> --
> Tim Bish
> twitter: @tabish121
> blog: http://timbish.blogspot.com/
>
>