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 Previous  1, 2
MQCB() only to receive mesages View previous topic :: View next topic
Author Message
sebastia
PostPosted: Mon Jun 15, 2015 7:50 am Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Mon Jun 15, 2015 7:56 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17446

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
View user's profile Send private message
sebastia
PostPosted: Mon Jun 15, 2015 8:05 am Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Mon Jun 15, 2015 8:09 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17446

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
View user's profile Send private message
sebastia
PostPosted: Mon Jun 15, 2015 8:10 am Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

oh, yes - C libraries have to be re-entrant, yes, of course

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

Grand Master

Joined: 25 Jun 2008
Posts: 17446

sebastia wrote:
sorry

No worries, I was unclear.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Goto page Previous  1, 2 Page 2 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.