MQ

MQ

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  MQ Message For K8 PODs

    Posted Tue September 08, 2020 04:44 PM
    Edited by om prakash Tue September 08, 2020 04:46 PM
    We have .net app running using .NET MQ library on ver 9.1
    Now we need to move this app as nodeJS into container running on K8.

    Our requirement is:
     - If the POD is terminated, the message should rollback
     - Use READ AHEAD and on successful app transaction, then commit and remove the message. During this time, other replicas of the app should not read the message.
     

    How do we achieve this?

    Should we use ibmmq ?
    If using .NET library, what options should we open the queue.

    Does REST interface for BROWSE support it?

    Is SQS, we have visibility time period, so that will prevent the message to be read from other threads, etc.. How do we achieve same in MQ.



    ------------------------------
    om prakash
    WI
    ------------------------------


  • 2.  RE: MQ Message For K8 PODs

    Posted Wed September 09, 2020 01:46 AM
    Hi Om

    You seem to be looking for some capabilities which would be impossible in combination.

    In order to achieve rollback on pod termination, you would need to configure your MQGET operation under syncpoint. If the messages are sufficiently important to be retried on pod failure, then presumably they would be persistent too.

    Client Readahead is disabled for GETs under syncpoint and for persistent messages, so you won't get both.

    The REST interface does support browse, but doesn't implement locks, so your other instances will also be able to see the messages. The REST interface does not support separation of the GET and the commit, so you won't get rollback on pod failure.

    I don't think you can achieve what you want with MQ.

    I would be surprised to find any messaging system that could implement read ahead and reliable commit processing against persistent messages.

    If you remove the requirement for read ahead, then MQ using the MQI can implement your commit and rollback requirement, including preventing other instances from seeing the message. There is an unsupported nodeJS library for MQ which includes Commit and Rollback functionality, so I would assume that you could use that providing the lack of support is not an issue. See .https://github.com/ibm-messaging/mq-mqi-nodejs

    As far as I'm aware you can't run .NET on k8s with normal pods. I think you will need to rewrite your code to a suitable pod hostable language (like javascript running on nodeJS). I don't know about running with Windows based pods.


    ------------------------------
    Neil Casey
    Senior Consultant
    Syntegrity Solutions
    Melbourne, Victoria
    IBM Champion (Cloud) 2019-20
    +61 (0) 414 615 334
    ------------------------------



  • 3.  RE: MQ Message For K8 PODs

    Posted Wed September 09, 2020 04:58 PM
    We can have the app issue a GET. How do we issue rollback using nodeJS when the POD crashes.

    ------------------------------
    om prakash
    WI
    ------------------------------



  • 4.  RE: MQ Message For K8 PODs

    Posted Thu September 10, 2020 01:23 AM
    Hi Om,

    Although I haven't programmed MQ with the nodeJS API, I looked at the github site and reviewed the implementation.

    It looks like you should be able to specify the GetMessageOptions (MQGMO_options) field, and include the option MQGMO_SYNCPOINT. This ensures that the GET operation happens under syncpoint control. If the connection from your nodeJS application is broken (say by a pod crash) before the unit of work is committed, it will automatically be rolled back.

    Your program should perform the MQGET with the SYNCPOINT option specified, and when the application has finished processing the message, it should use the MQCMIT call to commit the work and remove the message from the queue. The message is locked for all other users while your unit of work is in progress.

    If your application gets a problem and determines that if can't complete processing, but hasn't crashed, it can force MQ to roll back the unit of work using the MQBACK call.

    As I said, I haven't tested these APIs in the nodeJS environment. I did check to see that the supplied code does include implementations for them though, so I would expect it all to work.

    You may have to use MQBEGIN to start the unit of work before your MQGET call, but I think that happens automatically when you use the MQGMO_SYNCPOINT option.

    Regards,

    ------------------------------
    Neil Casey
    Senior Consultant
    Syntegrity Solutions
    Melbourne, Victoria
    IBM Champion (Cloud) 2019-20
    +61 (0) 414 615 334
    ------------------------------



  • 5.  RE: MQ Message For K8 PODs

    Posted Wed September 09, 2020 05:29 AM
    Hi Om,
    I think you need to wrap your .net into edge.js if you want to run it with node.js
    Personally I would go for jms or c++ pods.
    The API supports both browse and get messages.
    You may want to read an article about commit, back out and sync points.
    https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev.doc/q026790_.htm

    What messages are you worried about.
    If the pod is reading a message while crashing, the message stays in the qmgr queue.
    If the pod is crashing while submitting a message, the message never reaches the qmgr queue
    If the pod is reading the message ( message consumed ), then crashes without doing something useful with the message - that message is gone

    ------------------------------
    Matthias Jungbauer
    ------------------------------



  • 6.  RE: MQ Message For K8 PODs

    Posted Wed September 09, 2020 04:55 PM
    The below 2 are important:

    If the pod is reading a message while crashing, the message stays in the qmgr queue.
    If the pod is crashing while submitting a message, the message never reaches the qmgr queue

    How do we implement in nodeJS using the ibmmq nodejs library.

    ------------------------------
    om prakash
    WI
    ------------------------------



  • 7.  RE: MQ Message For K8 PODs

    Posted Wed September 09, 2020 05:34 PM
    https://www.npmjs.com/package/ibmmq
    Read the docu. samples are in the github
    Mark cannot wait to get your comments.
    https://community.ibm.com/community/user/imwuc/viewdocument/easier-use-of-the-nodejs-interface?CommunityKey=b382f2ab-42f1-4932-aa8b-8786ca722d55

    ------------------------------
    Matthias Jungbauer
    ------------------------------