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.  How to create subscription type API in IBM MQ v9.*

    Posted Tue August 22, 2023 09:33 AM

    Hi All,

    I need your help to create subscription type API in IBM MQ v9.*. As documentation says API: Subscription created through an MQSUB API request.

    I am not sure how to use MQSUB API to create subscription.

    Any help will be highly appreciated.

     Thanks



    ------------------------------
    Hosh Mohammad
    ------------------------------



  • 2.  RE: How to create subscription type API in IBM MQ v9.*

    Posted Tue August 22, 2023 03:45 PM

    Hi Hosh,

    You should review the code in the IBM-supplied sample amqssuba.c and run the same compiled sample amqssub. This uses MQSUB and will create a SUBTYPE(API) subscription. Here is an example invocation, where MQG1 is my queue manager name.

    amqssub Test MQG1

    Bear in mind that this subscsription is not given a subname and so when you display it, you will see a blank name for the SUB.

    Cheers,
    Morag



    ------------------------------
    Morag Hughson
    MQ Technical Education Specialist
    MQGem Software Limited
    Website: https://www.mqgem.com
    ------------------------------



  • 3.  RE: How to create subscription type API in IBM MQ v9.*
    Best Answer

    Posted Wed August 23, 2023 03:59 AM

    Hi Hosh,

    To add to Morag's suggestion, if you want subname you can use amqssbxa sample.

    Excerpt from amqssbxa.c sample source code:

    AMQSSBXA has the following parameters                         
        required, at least one of:                                
             -t <string>  Topic string                            
             -o <name>    Topic object name                       
        optional:                                                 
             -m <name>    Queue manager name                      
             -b <type>    Connection binding type (def = standard)
                           standard     MQCNO_STANDARD_BINDING    
                           shared       MQCNO_SHARED_BINDING      
                           fastpath     MQCNO_FASTPATH_BINDING    
                           isolated     MQCNO_ISOLATED_BINDING    
             -q <name>    Destination queue name                  
             -w <seconds> Wait interval on MQGET (def = 30)       
                           unlimited     MQWI_UNLIMITED           
                           none          no wait                  
                           n             wait interval in seconds 
             -d <subname> Create/resume named durable subscription
             -k           Keep durable subscription on MQCLOSE    
                                                                  
    Example invocations:                                          
                                                                  
    # Create an unnamed non-durable subscription to /news on QM1  
                                                                  
      amqssbx -m QM1 -t /news                                     
                                                                  
    # Create or resume a durable subscription named MySub         
    # to /sport/results on QM1                                    
                                                                  
      amqssbx -m QM1 -d MySub -t /sport/results                   
                                                                  
    # Create or resume a durable subscription named LotterySub to 
    # lottery.results and end immediately when no more messages   
    # exist. Do not remove subscripton when program ends.         
                                                                  
      amqssbx -m QM1 -d LotterySub -t lottery.results -w none -k  



    ------------------------------
    UMAMAHESH PONNUSWAMY
    ------------------------------



  • 4.  RE: How to create subscription type API in IBM MQ v9.*

    Posted Thu August 24, 2023 09:19 AM

    This approach has been effective, and I appreciate your help. However, I've encountered an issue during the queue manager migration process. It appears that the API-type subscribers, specifically those with a subtype of "API," are not getting migrated successfully. Do you have any insights on what might be causing this issue?

    Thanks



    ------------------------------
    Hosh Mohammad
    ------------------------------



  • 5.  RE: How to create subscription type API in IBM MQ v9.*

    Posted Thu August 24, 2023 09:37 AM

    Hi Hosh, 

    Could you please share the migration steps and the type of subscription (durable or non-durable) not getting migrated.

    Regards,

    mahesh



    ------------------------------
    UMAMAHESH PONNUSWAMY
    ------------------------------



  • 6.  RE: How to create subscription type API in IBM MQ v9.*

    Posted Thu August 24, 2023 09:55 AM

    Hi Mahesh,

    On the source machine, I'm using the following script command to create a backup of QM1:

    dmpmqcfg -m QM1 -t all -x all -o mqsc -a > c:\backup\QM1.mqsc

    Meanwhile, on the destination machine, I'm using the subsequent script commands:
    crtmqm -q QM1
    strmqm QM1 
    runmqsc QM1 < c:\backup\QM1.mqsc

    Regards

    Hosh



    ------------------------------
    Hosh Mohammad
    ------------------------------



  • 7.  RE: How to create subscription type API in IBM MQ v9.*

    Posted Thu August 24, 2023 10:55 AM

    Hi Hosh,

    The dmpmqcfg only creates backup for the object definitions and API subscription can not be backed up using dmpmqcfg.

      https://www.ibm.com/docs/en/ibm-mq/9.3?topic=reference-dmpmqcfg-dump-queue-manager-configuration

    QM migration(including data) usually includes starting the QM at higher MQ version which includes migration of queues, subscriptions etc.

    with the message in the queues. The procedure you are following creates a new QM and then recreates objects. In this case the applications

    needs to re-create subscriptions needed. 

    Regards,

    mahesh



    ------------------------------
    UMAMAHESH PONNUSWAMY
    ------------------------------