ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ API SupportMQCB() only to receive mesages

Post new topicReply to topic Goto page 1, 2  Next
MQCB() only to receive mesages View previous topic :: View next topic
Author Message
sebastia
PostPosted: Mon Jun 15, 2015 4:56 am Post subject: MQCB() only to receive mesages Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

I see MQCB() has a Hconn input parameter
>>> https://www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.ref.dev.doc/q101720_.htm

This means that a MQCONN() has to be previously issued.

Conclusion : MQCB() can be used to receive messages (async operation with maybe large delays), but can not be used to connect to queue manager, another synchronous and blocking and slow operation.

Does anybody know of a way to create a MQ_CallBack_Connect() call ?

I need it to connect node.js to MQ ...

Sebastian.
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Mon Jun 15, 2015 5:13 am Post subject: Re: MQCB() only to receive mesages Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19196
Location: LI,NY

sebastia wrote:
I see MQCB() has a Hconn input parameter
>>> https://www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.ref.dev.doc/q101720_.htm

This means that a MQCONN() has to be previously issued.

Conclusion : MQCB() can be used to receive messages (async operation with maybe large delays), but can not be used to connect to queue manager, another synchronous and blocking and slow operation.

Does anybody know of a way to create a MQ_CallBack_Connect() call ?

I need it to connect node.js to MQ ...

Sebastian.


I thought that MQCB() used a standard MQConnection... so why are you looking for a specific MQ_CallBack_Connect() call ?? You can have multiple connections open simultaneously to the same queue manager right?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
sebastia
PostPosted: Mon Jun 15, 2015 5:30 am Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

I need an ASYNCHRONOUS mq_connect(), so the node.js application does not block on every mq_connect

I dont think we need multiple connections to the same (local) queue manager, but certainly will need multiple connections to multiple remote queue managers.

Remember " node.js access to MQ API"

>>> http://www.mqseries.net/phpBB2/viewtopic.php?t=70285

I am still in that, jejeje
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Mon Jun 15, 2015 5:38 am Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19196
Location: LI,NY

I think you need to understand that what you are dealing with is essentially a pub/sub model... Now wouldn't the XMS library be closer to what you should be looking at?

As well you do not specify which end you are looking at (server or client) ?
Are you by any chance trying to build your own threading model?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon Jun 15, 2015 5:45 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17295

fjb_saper wrote:
I think you need to understand that what you are dealing with is essentially a pub/sub model... Now wouldn't the XMS library be closer to what you should be looking at?

I'm quite sure you can't use XMS from JavaScript.

node.js is a JavaScript environment.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jun 15, 2015 6:03 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17295

I don't really find much reference to MQ_Callback_Connect()

Where are you finding information on it?

Are you trying to use MQTT or HTTP? Or plain MQI from javascript ? (how did you manage that?)
Back to top
View user's profile Send private message
sebastia
PostPosted: Mon Jun 15, 2015 6:08 am Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

mr Saper - I dont understand why you talk about pub/sub

I want an Async mqconnect() and later ... put come mesages into command queue, jejeje

If pub/sub is mandatory involved i have to go away, jejeje

I am looking to connect to few qmgrs under HTML requests from a browser.
So I would say I am looking at "serve" end, am I right ?

"Threading model" ? what is the exact meaning of that ?
There is a programming model I have in mind which involves threads, yes.
The call from node.js application comes into my C code; there I start a separate thread and return to nodejs indicating "operation started".

The thread of couse issues a mqconnect() and gets blocked until operation ends, at which moment it goes back to node.js code to the place indicated by the callback() routine provided at start.

So, I would answer "yes", I am trying to implement my own threading model. Do you have any informatoin on that ?

Sebastian.
Back to top
View user's profile Send private message Visit poster's website
sebastia
PostPosted: Mon Jun 15, 2015 6:17 am Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

Jeff : "MQ_Callback_Connect()" is a new function I have to implement, as MQ_callback() is useless to me and nodejs

no MQTT, thats pub/sub only I think to remember

sorry for misleading you ...
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Mon Jun 15, 2015 6:25 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17295

Ok, so you're using node.js to call c programs under the covers that will then make MQ api calls.

That is, you're making standard MQ API calls to MQ.

So inside your c program you will make a plain MQCONN to connect to the queue manager, which will return an HOBJ. You will then use MQCB to register a c-language callback function, which will then do what you need to send a message back to node.js.

You can implement threads either in your node-js, and use a c-function to register the right places to return messages back to node-js (i.e. how to give a message to the right thread - or even just in a load-balanced way).

Or you can use the MQCB to specify a multi-threaded structure, which will then execute your callback in another thread.

Or you can implement a threading model in C that registers separate MQCBs, each in the calling thread.
Back to top
View user's profile Send private message
sebastia
PostPosted: Mon Jun 15, 2015 6:39 am Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

mr Jeff - I agree on all that you say.

But the objective of the thread model is to provide a callback() for the MQCONNECT ...

To receive messages in asynch mode, we can use standard MQCB().
Dont need the thread, guess. Or maybe we will use it

But we shall talk about receiving messages when we come to that bridge.

First step, and the most dificult one, as MQ API does not help, is to do a MQCONN() from node.js

Thanks for sharing your opinions.

Sebastian.
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Mon Jun 15, 2015 6:55 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17295

Yes. node.js can't call MQ API calls.

You can set up the MQ HTTP Bridge, and call that. But that doesn't let you do asynchronous calls.

You can use MQTT, but as you say that's a pub/sub model. But you can certainly do request-reply over pub/sub. You just need a requester-specific reply topic.

MQCB lets you execute your call back in a separate thread, and will create one or more (look for posts from Paul Clarke on MQCB in this area) threads for you.

So without doing any kind of thread work in your own code, you can get a multi-threaded implementation.

You still need to figure out how to talk between node.js and something that can call the plain MQ API.
Back to top
View user's profile Send private message
sebastia
PostPosted: Mon Jun 15, 2015 7:00 am Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

Again, agree 100%

1) "node.js can't call MQ API calls"
2) "how to talk between node.js and something that can call the plain MQ API"

I think I shall go into the multi-thread model, using one thread per queue manager involved. I can have a thread that receives "commands" as, "connect" or "disconnect", or "open" or "close".
The thread works in "blocking" mode, this is "standard" MQ API.

Now I have to figure out
a) how to pass commands from node.js and this "server thread"
b) how to pass responses from this C thread back to node.js "callback"

I'd say (B) is the point I understand less at this moment.

Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Mon Jun 15, 2015 7:06 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17295

If you went with plain TCP/IP (and I don't know if you can do that from node.js), you could keep the incoming socket in an array or something and then send the reply back over that. Or otherwise use standard TCP methods to respond to incoming requests.

Regardless, the method you use to interface with C will have to include a way to receive data and return it.

It's *possible*, but again I don't know, that node.js will let you create bindings to c libraries (ala JNI in regular Java).
Back to top
View user's profile Send private message
sebastia
PostPosted: Mon Jun 15, 2015 7:16 am Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

a) plain tcp/ip - i dont see it this way
b) yes, data received at the "mq server" thread has to go to node.js via callback
c) "c" libraries - jajaja - I have spent some time on this.

node.js wants to go thry "c++" way :

Code:
#include <node.h>

using namespace v8;

Handle<Value> Callback(const Arguments& args) {
    HandleScope scope;


Here are two good pointers I have, just if someone is interested

===
// nodejs intro : https://nodejs.org/api/addons.html
// callback sample : https://github.com/kkaefer/node-cpp-modules
===

But node.js coming from C++ I see this is the way.
I dont like, I prefer pure C with MQ API, but shall have no problem.
Except the multi-threading, jejeje

"once I know the answers, they change the questions", sure


[/code]
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Mon Jun 15, 2015 7:29 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17295

You can of course just use straight c from a minimal c++ object framework.

And again, the MQCB callback can deal with threads for you.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum IndexIBM MQ API SupportMQCB() only to receive mesages
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.