You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Matthew Karlsen <MK...@idbs.com> on 2015/10/23 10:00:23 UTC

Basic send/receive AMQP message to HornetQ server using Python

Hello,

I am currently attempting to use the code on https://qpid.apache.org/releases/qpid-proton-0.10/proton/python/tutorial/tutorial.html to send and receive a message to a HornetQ server.

(Slightly modified code below...)

I have set up a HornetQ core queue called exampleQueue1 to connect to and am running the server. I get, e.g. "08:29:28,247 INFO  [org.hornetq.core.server] HQ221003: trying to deploy queue exampleQueue1" on the server console.

I have compiled the required c code for the example to run properly.

When I run the example below I get "ERROR:root:amqp:connection:framing-error: SASL header mismatch: Insufficient data to determine protocol [''] (connection aborted)" repeatedly until I kill the program.

I have googled this error but get very few hits and have not found one that is sufficiently explanatory.

I will continue to try to work out how to solve this issue. However, I was wondering if anyone could assist with this question?

Thanks & regards,
Matthew


from __future__ import print_function
from proton import Message
from proton.handlers import MessagingHandler
from proton.reactor import Container

class HelloWorld(MessagingHandler):
    def __init__(self, server, address):
        super(HelloWorld, self).__init__()
        self.server = server
        self.address = address

    def on_start(self, event):
        conn = event.container.connect(self.server)
        event.container.create_receiver(conn, self.address)
        event.container.create_sender(conn, self.address)

    def on_sendable(self, event):
        event.sender.send(Message(body="Hello World!"))
        event.sender.close()

    def on_message(self, event):
        print(event.message.body)
        event.connection.close()

helloWorld = HelloWorld("amqp://guest:guest@localhost:5672", "exampleQueue1")
Container(helloWorld).run()




RE: Basic send/receive AMQP message to HornetQ server using Python

Posted by Matthew Karlsen <MK...@idbs.com>.
Many thanks for the response.

I checked the manual and HornetQ does support SASL and AMQP is enabled.

The issue (solved with assistance from Justin Bertram on the Jboss forums: https://developer.jboss.org/thread/265676) was a misunderstanding concerning queue configuration.

Just in case anyone else tries to do the same thing and finds this, the "correct" config I used included:

<queues>    
    <queue name="exampleQueue1"> 
        <address>exampleQueue1</address>
        <durable>true</durable>
    </queue>
    <queue name="exampleQueue2"> 
        <address>exampleQueue2</address> 
        <durable>true</durable>
    </queue> 
</queues>

And

<acceptor name="proton-acceptor">
    <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
    <param key="protocols" value="AMQP"/>
    <param key="host" value="0.0.0.0"/>
    <param key="port" value="5672"/>
</acceptor>

With these changes (primarily a queue address change) the example works.

Thanks again for the help, and for pointing me to Wireshark which is really useful!




-----Original Message-----
From: Gordon Sim [mailto:gsim@redhat.com] 
Sent: 23 October 2015 10:09
To: users@qpid.apache.org
Subject: Re: Basic send/receive AMQP message to HornetQ server using Python

On 10/23/2015 09:00 AM, Matthew Karlsen wrote:
> Hello,
>
> I am currently attempting to use the code on https://qpid.apache.org/releases/qpid-proton-0.10/proton/python/tutorial/tutorial.html to send and receive a message to a HornetQ server.
>
> (Slightly modified code below...)
>
> I have set up a HornetQ core queue called exampleQueue1 to connect to and am running the server. I get, e.g. "08:29:28,247 INFO  [org.hornetq.core.server] HQ221003: trying to deploy queue exampleQueue1" on the server console.
>
> I have compiled the required c code for the example to run properly.
>
> When I run the example below I get "ERROR:root:amqp:connection:framing-error: SASL header mismatch: Insufficient data to determine protocol [''] (connection aborted)" repeatedly until I kill the program.
>
> I have googled this error but get very few hits and have not found one that is sufficiently explanatory.
>
> I will continue to try to work out how to solve this issue. However, I was wondering if anyone could assist with this question?

It sounds like the client is sending the SASL AMQP protocol header, and the broker is not replying as expected with an AMQP protocol header. You could verify that by running wireshark. Setting PN_TRACE_FRM=1 while running the client will also print some details (but that is the client's view).

Is AMQP definitely enabled on the broker? Does the version in use support SASL?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Basic send/receive AMQP message to HornetQ server using Python

Posted by Gordon Sim <gs...@redhat.com>.
On 10/23/2015 09:00 AM, Matthew Karlsen wrote:
> Hello,
>
> I am currently attempting to use the code on https://qpid.apache.org/releases/qpid-proton-0.10/proton/python/tutorial/tutorial.html to send and receive a message to a HornetQ server.
>
> (Slightly modified code below...)
>
> I have set up a HornetQ core queue called exampleQueue1 to connect to and am running the server. I get, e.g. "08:29:28,247 INFO  [org.hornetq.core.server] HQ221003: trying to deploy queue exampleQueue1" on the server console.
>
> I have compiled the required c code for the example to run properly.
>
> When I run the example below I get "ERROR:root:amqp:connection:framing-error: SASL header mismatch: Insufficient data to determine protocol [''] (connection aborted)" repeatedly until I kill the program.
>
> I have googled this error but get very few hits and have not found one that is sufficiently explanatory.
>
> I will continue to try to work out how to solve this issue. However, I was wondering if anyone could assist with this question?

It sounds like the client is sending the SASL AMQP protocol header, and 
the broker is not replying as expected with an AMQP protocol header. You 
could verify that by running wireshark. Setting PN_TRACE_FRM=1 while 
running the client will also print some details (but that is the 
client's view).

Is AMQP definitely enabled on the broker? Does the version in use 
support SASL?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org