Author |
Message
|
sebastia |
Posted: Thu Mar 14, 2013 7:42 am Post subject: how to use MQSUB() to read msg pub'd by mosquitto_pub.exe |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
Hi, coleagues.
Using MQ API, I am trying to receive MQ messages ...
... published using "mosquitto_pub.exe" to a mosquito.exe broker
My sample is "amqssuba.c", but it requires a "managed destination queue", on which it issues MQGET() in a loop ...
I see "sd.Options := MQSO_MANAGED", but I think there is no such queue on mosquitto ...
Can someone provide some light on this subject ?
Maybe mosquitto messages are NOT MQ messages, so it is pointless to try to read them using MQ API .... jejeje
In this case, I could setup an environment where "mosquito_pub.exe" uses a topic that is implemented in a MQ queue manager, so then my use of the API would be more convenient ... am I right ?
Thanks for your (constructive) comments.
Sebastian. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Mar 14, 2013 8:09 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I believe mosquito uses mqtt.
So you'd configure an MQTT endpoint in your queue manager, and then topics published to mqtt should show up as mq messages on subscription queues.
But I suspect some brit will be along in a minute to correct me. |
|
Back to top |
|
 |
sebastia |
Posted: Thu Mar 14, 2013 8:29 am Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
... it is good to have an open conversation, with a nice exchange of points of view ... |
|
Back to top |
|
 |
Vitor |
Posted: Thu Mar 14, 2013 8:57 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
But I suspect some brit will be along in a minute to correct me. |
Depending on the scale & duration of the party.......  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
sebastia |
Posted: Thu Mar 14, 2013 10:55 pm Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
So, Jeff - let me resume to see if I did understand you properly - I am not a native english speaker ... sorry
You are saying (and me ...)
a) to use MQ instead of mosquitto.exe broker ...
b) the TT producer (mosquitto_publish.exe) should point to Queue Manager IP and port ...
c) I can mqget() messages as usual, as amssuba.c - I pretend to use Dougie Lawson's "mqsub.rex" ...
I agree on all points ...
Just 1 question left :
... what is the meaning of the phrase "AMQSSUBA uses a managed destination queue" ?
Sebastian. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Mar 15, 2013 2:49 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I'm not saying use MQ instead of MQTT.
I'm saying tell Mosquito how to find a queue manager that has an MQTT channel defined on it.
But I'm still waiting for andypiper to notice this thread, cause I only vaguely know what I'm talking about. |
|
Back to top |
|
 |
Michael Dag |
Posted: Fri Mar 15, 2013 2:55 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
Hello Sebastian,
if you use MQSUB API call you register your interest for a publiction with the QMgr, when a publication is made for example by mosquitto via MQTT to the QMgr... Then MQ put's this message to a Queue so you can get it using MQGET.
The Queue that is needed is either a Queue that has been setup for you in advance (same as using the DEFINE SUB using MQSC) or a dynamically created / aka systems managed queue like for example SYSTEMS.NDURABLE.MODEL.QUEUE or DURABLE etc...
More can be found here: http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.amqnar.doc%2Fps10437_.htm
hope it helps _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
sebastia |
Posted: Fri Mar 15, 2013 3:01 am Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
Jeff - we are getting to the point I had some doubt ...
(1) when you say
"" tell Mosquito how to find a QM ... ""
... that "tell mosquito"
... is refering to the "broker" (mosquitto.exe)
... or to the message producer (mosquitto_publish.exe) ?
Sure it has to be message producer ...
Another point :
(2) when you say "" that has an MQTT channel defined "" ...
you are refering to this channel
Quote: |
# Create and start a channel
echo "DEFINE CHANNEL('PlainText') CHLTYPE(MQTT) PORT(1883) MCAUSER('nobody')" | runmqsc MQXR_SAMPLE_QM |
Thanks for your comments - they help me clarify my thoughts ... |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Mar 15, 2013 3:14 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I'm just guessing here, sebastia, but I believe what you want is for it to work like this.
publisher->broker->mq->subscriber.
This allows both broker and mq to forward messages along to each subscriber they happen to know about.
If you don't intend to have any subscribers that only talk to mosquitto broker, then yes, you would
publisher->mq->subscriber
instead.
But, yes, I'm referring to an MQ channel of chltype(MQTT). |
|
Back to top |
|
 |
sebastia |
Posted: Fri Mar 15, 2013 3:56 am Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
I was thinking on having only one broker, the MQ itself, without mosquitto.exe, but now you have opened my eyes to have them BOTH !
Is it possible ?
How do I tell MQ to connect to mosquitto broker ?
Or to "work together" ?
The publisher parameters are
Quote: |
SET MYHOST=99.137.164.25
SET MYQOS=0
SET MYMSG=txt2pub.txt
SET MYTOPIC=monit/pcs
SET MYID=mosquitto_pub_client
mosquitto_pub.exe -d -h %MYHOST% -q %MYQOS% -f %MYMSG% -t %MYTOPIC% -i %MYID% |
... so the published msg is "sent" to a specific IP (and PORT), where only one listener will be allowed ... |
|
Back to top |
|
 |
sebastia |
Posted: Fri Mar 15, 2013 3:59 am Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
Michael Dag wrote: |
Hello Sebastian,
if you use MQSUB API call you register your interest for a publiction with the QMgr, when a publication is made for example by mosquitto via MQTT to the QMgr... Then MQ put's this message to a Queue so you can get it using MQGET.
The Queue that is needed is either a Queue that has been setup for you in advance (same as using the DEFINE SUB using MQSC) or a dynamically created / aka systems managed queue like for example SYSTEMS.NDURABLE.MODEL.QUEUE or DURABLE etc...
More can be found here: http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.amqnar.doc%2Fps10437_.htm
hope it helps |
Thanks for the pointer, mr DAG.
And you can be sure I was one of the first spaniards to watch the "number 14" film here in Barcelona ... 1973 ... good times ...
Of course, I am still a "Cruyf-fist" ... jejeje |
|
Back to top |
|
 |
Michael Dag |
Posted: Fri Mar 15, 2013 4:04 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
sebastia wrote: |
Michael Dag wrote: |
Hello Sebastian,
if you use MQSUB API call you register your interest for a publiction with the QMgr, when a publication is made for example by mosquitto via MQTT to the QMgr... Then MQ put's this message to a Queue so you can get it using MQGET.
The Queue that is needed is either a Queue that has been setup for you in advance (same as using the DEFINE SUB using MQSC) or a dynamically created / aka systems managed queue like for example SYSTEMS.NDURABLE.MODEL.QUEUE or DURABLE etc...
More can be found here: http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.amqnar.doc%2Fps10437_.htm
hope it helps |
Thanks for the pointer, mr DAG.
And you can be sure I was one of the first spaniards to watch the "number 14" film here in Barcelona ... 1973 ... good times ...
Of course, I am still a "Cruyf-fist" ... jejeje |
was it translated into spanish? I only have a dutch version and recently gave it to a friend in Barcelona _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
sebastia |
Posted: Fri Mar 15, 2013 4:12 am Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
no, no - in 1973 Johan came to Barcelona, and then there was a heathqake in Nicaragua and he had the film rights (at least in Spain) and he gave the film to collect money to send it to Nicaragua, and I went to see it ... in english - incredible to see all the people in the stadium shouting "cruyf, cruf, ... johan cruyf" ... jejeje |
|
Back to top |
|
 |
Michael Dag |
Posted: Fri Mar 15, 2013 4:19 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
sebastia wrote: |
no, no - in 1973 Johan came to Barcelona, and then there was a heathqake in Nicaragua and he had the film rights (at least in Spain) and he gave the film to collect money to send it to Nicaragua, and I went to see it ... in english - incredible to see all the people in the stadium shouting "cruyf, cruf, ... johan cruyf" ... jejeje |
ah ok, sent you an e-mail at tinet.org  _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
sebastia |
Posted: Fri Mar 15, 2013 4:22 am Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
Michael Dag wrote: |
ah ok, sent you an e-mail at tinet.org  |
Where did you find this email ?
It has to be changed to tinet.cat ... even both do work, I'd say ... |
|
Back to top |
|
 |
|