|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
MQCB() only to receive mesages |
« View previous topic :: View next topic » |
Author |
Message
|
sebastia |
Posted: Mon Jun 15, 2015 7:50 am Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
I see the "mq server thread" structure to be like this :
Code: |
wait ( semaphore ) ;
new_comand := thread-control-block.new_command ;
start MQ command ( new_command ) ;
return MQ command status ; -------------------------> go to point (2)
|
And the thread-manager has to be something like this
Code: |
EntryPoint MyMQ.connect:
locate-thread-for this-browser-and-qmgrr() ;
if thread.status = waiting-command
then
thread.command := new-operation ;
return-ok 'operation started' ------------------> go to point (1)
else
return-error 'thread already working'
|
Both points (1) and (2) are in node.js code :
Code: |
var express = require( 'express' ) ;
var app = express() ;
var MyMQ = require( './nodeMQsebas' ) ; // own module
app.get( '/connect-to-mq/qmgr_name=:qmgrname', function ( req, res ) {
var MyQmgrName = req.params.qmgrname ;
console.log( ">>> Client wants to connect to queue manager {"+ MyQmgrName +"}." ) ;
MyMQ.connect ( MyQmgrName, function ( err, result ) {
------------------------------------------------------ (2) mq api call ends
if ( err ) {
var szErr = "--- Cant connect to QMGR. Error is ("+err+")." ;
console.log( szErr ) ;
res.status( 200 ).send( szErr ) ;
} else {
res.status( 200 ).send( "+++ Connect OK." ) ;
} ; // else
} ) ; // connect CallBack
------------------------------------------------------ (1) mq api call starts
} ) ; // connect-to-mq
|
Have to relax and think a bit more
 |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jun 15, 2015 7:56 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Ok, that creates a thread in node.js, rather than a thread in C++.
Perfectly reasonable. You just have to make sure your c++ code is thread-safe (re-entrant).
Maybe node.js handles that for you. |
|
Back to top |
|
 |
sebastia |
Posted: Mon Jun 15, 2015 8:05 am Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
there shall be one diferent thread for everu queue manager a specific client (browser) wants to access
why shall the code be re-entrant ?
every thread is a loop
1) wait onsemaphore
2) get command and execute it
3) send RC to node.js (how do we do that?)
4) go to semaphone again |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jun 15, 2015 8:09 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
sebastia wrote: |
why shall the code be re-entrant ? |
I meant the C++ code. And it's because each node.js thread could be calling the same C++ routines at the same time. |
|
Back to top |
|
 |
sebastia |
Posted: Mon Jun 15, 2015 8:10 am Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
oh, yes - C libraries have to be re-entrant, yes, of course
sorry |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jun 15, 2015 8:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
No worries, I was unclear. |
|
Back to top |
|
 |
|
|
|
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
|
|
|
|