App Connect

App Connect

Join this online user 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.


#Applicationintegration
#App Connect
#AppConnect
 View Only

IIB 10: Bus Event monitoring with MQTT - no events published when subscribed remotely

  • 1.  IIB 10: Bus Event monitoring with MQTT - no events published when subscribed remotely

    Posted Fri May 11, 2018 02:22 AM

    Hello

    [EDIT 2 - start]

    I provided the detail below to head off 'are you sure..?' questions. I think I have narrowed the problem down to the use of 'localhost' or when connecting to IIB's MQTT Broker. The are two conditions, only one works:

    • bind_address = 'localhost'. Monitoring events are published, and my client's 'messageReceived' callback method receives these events.
    • bind_address = . I can't tell whether events are published or not, but none are received.

    In both cases the MQTT client is running locally, on the same system as IIB. The same topic string is used when subscribing.

    The ClientId for each connection is: 'CONSTANT+Topic-string' to ensure uniqueness.

    What could be the cause of the different behaviour?

    [EDIT 2 - end]

     

    This is Windows 10 and IIB 10.0.0.11

    I am developing a 'client' that subscribes to Business Monitoring, using the IntegrationAPI.

    My client gets info on what to monitor, where and how to connect from a config xml file that is read at startup.

    The client works using MQ/JMS connections on a local IIB and a remote one ['works' = monitoring events are produced and received by the client]. However, when using MQTT, my client only sees events that are produced when the connection is to a local IIB. This is driving  me crazy.

    Is there a way to display the active MQTT subscriptions for the MQTT broker?

    Is there a way to know whether events are being produced? (When  using MQ/JMS, I can make a permanent subscription to a topic object and put the events in a queue)

    I discovered this first with a cusomter who is helping with this as a PoC/PoT. I have now installed IIB and MQ on a second laptpop, to debug this locally.I've disabled Windows firewalls and verified the tcp connections to the remote IIB using the PowerShell and command:

    Test-NetConnection -Port 11885 -ComputerName JOT420 -InformationLevel Detailed 

    I will attenpt to explain why I think the MQTT subscription topic strings must be correct.

    • a message flow to be monitored has to be active
    • it's topology (nodes and connections) is read
    • this is used to create a  Monitoring Profile (for the flow and its subflows)
    • this is applied to the msgflow and monitoring is activated (can be verified in the Web GUI)
    • the above is the same whether using MQ/JMS or MQTT subscriptions

    A thread is created for each topic, and itis used to make a JMS or MQTT connection and subscription. It gets its values from those used above. For a subscription to my remote laptop, the log shows:

    Topic = 'IBM/IntegrationBus/nJAMS/Monitoring/njamsApps/HTTPInputMessageFlow'

    The values in italics are: (1) the Int Node name, (2) the Int Server name.

    If these were not correct, I wouldn't be able to find the msgflows in the first place.

    I really hope someone can point out some simple thing that I have overlooked.

    Regards, John

    .EDIT 1

    I think the cause of this problem is something to do with the hostname used in the MQTT connection.

    • in order to makea remote MQTT connection, I found that the 'bind_address' in C:\ProgramData\IBM\MQSI\components\\config had to be changed from 'localhost' to the actual host-name.
    • One consequence of this, is that an attempt to make an MQTT connection to the local IIB using 'localhost' fails (that was anticipated). To make an MQTT connection to the local IIB, I have to use host-name.

    The result is that, either monitoring events are not being published by MQTT, or my client's subscription isn't actually takimng effect.

    Should my MQTT connection code be different when conecting to a remote MQTT server?

    I think all the examples I found, used 'localhost'.

    The log entries for:

    • serverURL connection is: MQTT server URL: 'tcp://JOT420:11883
    • token.getResponse().toString() is:
      Response from Broker connection: CONNACK msgId 0 session present:false return code: 0.

    In the debugger, I can see that "mqttClient.subscribe(topic, qos);" doesn't thrown an exception