+

Search Tips | Advanced Search

Getting started with multicast

Use this information to get started with IBM MQ Multicast topics and communication information objects.


About this task

IBM MQ Multicast messaging uses the network to deliver messages by mapping topics to group addresses. The following tasks are a quick way to test if the required IP address and port are correctly configured for multicast messaging.

    Create a COMMINFO object for multicast
    The communication information (COMMINFO) object contains the attributes associated with multicast transmission. For more information about the COMMINFO object parameters, see DEFINE COMMINFO. Use the following command-line example to define a COMMINFO object for multicast:
    DEFINE COMMINFO(MC1) GRPADDR(group address) PORT(port number)
    
    where MC1 is the name of our COMMINFO object, group address is your group multicast IP address or DNS name, and the port number is the port to transmit on (The default value is 1414).

    A new COMMINFO object called MC1 is created; This name is the name that we must specify when defining a TOPIC object in the next example.

    Create a TOPIC object for multicast
    A topic is the subject of the information that is published in a publish/subscribe message, and a topic is defined by creating a TOPIC object. TOPIC objects have two parameters which define whether they can be used with multicast or not. These parameters are: COMMINFO and MCAST.

    • COMMINFO This parameter specifies the name of the multicast communication information object. For more information about the COMMINFO object parameters, see DEFINE COMMINFO.
    • MCAST This parameter specifies whether multicast is allowable at this position in the topic tree.

    Use the following command-line example to define a TOPIC object for multicast:

    DEFINE TOPIC(ALLSPORTS) TOPICSTR('Sports') COMMINFO(MC1) MCAST(ENABLED)
    

    A new TOPIC object called ALLSPORTS is created. It has a topic string Sports, its related communication information object is called MC1 (which is the name you specified when defining a COMMINFO object in the previous example), and multicast is enabled.

    Testing the multicast publish/subscribe

    After the TOPIC and COMMINFO objects have been created, they can be tested using the amqspubc sample and the amqssubc sample. For more information about these samples see The Publish/Subscribe sample programs.

    1. Open two command-line windows; The first command line is for the amqspubc publish sample, and the second command line is for the amqssubc subscribe sample.
    2. Enter the following command at command line 1:
      amqspubc Sports QM1
      
      where Sports is the topic string of the TOPIC object defined in an earlier example, and QM1 is the name of the queue manager.
    3. Enter the following command at command line 2:
      amqssubc Sports QM1
      
      where Sports and QM1 are the same as used in step 2.
    4. Enter Hello world at command line 1. If the port and IP address that are specified in the COMMINFO object are configured correctly; the amqssubc sample, which is listening on the port for publications from the specified address, outputs Hello world at command line 2.

Parent topic: Administer multicast

Last updated: 2020-10-04