Monday, 25 September 2017

Event Monitoring using MQSI Commands


Step 1 :- Create a flow like this


Now dont specify any thing in the Monitoring tab for the nodes.because here we are using commands

mqsicreateconfigurableservice MB -c MonitoringProfiles -o Sampleprofile

mqsichangeproperties MB -c MonitoringProfiles -o Sampleprofile -p 


Step 2:- In the compute node,the code should be like this:-

CREATE COMPUTE MODULE Event_Monitoring_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
CALL CopyEntireMessage();
RETURN TRUE;
END;



Step 3:- Create an Xml file with name Sample.xml on the Desktop & Copy this data


Sample.xml file:

  <profile:monitoringProfile xmlns:profile="http://www.ibm.com/xmlns/prod/websphere/messagebroker/6.1.0.3/monitoring/profile" profile:version="2.0">
  <profile:eventSource profile:eventSourceAddress="MQ Input.transaction.Start" profile:enabled="true">
  <profile:eventPointDataQuery>
  <profile:eventIdentity>
  <profile:eventName profile:literal="MQ Input.TransactionStart" /> 
  </profile:eventIdentity>
  <profile:eventCorrelation>
  <profile:localTransactionId profile:sourceOfId="automatic" /> 
  <profile:parentTransactionId profile:sourceOfId="automatic" /> 
  <profile:globalTransactionId profile:sourceOfId="automatic" /> 
  </profile:eventCorrelation>
  <profile:eventSequence profile:name="creationTime" /> 
  </profile:eventPointDataQuery>
  <profile:applicationDataQuery>
<profile:complexContent>
  <profile:payloadQuery profile:queryText="$Body/emp/eno"> 
  </profile:payloadQuery>
  </profile:complexContent>
  </profile:applicationDataQuery>
  <profile:bitstreamDataQuery profile:bitstreamContent="body" profile:encoding="base64Binary" /> 
  </profile:eventSource>
  <profile:eventSource profile:eventSourceAddress="MQ Input.transaction.End" profile:enabled="true">
  <profile:eventPointDataQuery>
  <profile:eventIdentity>
  <profile:eventName profile:literal="MQ Input.TransactionEnd" /> 
  </profile:eventIdentity>
  <profile:eventCorrelation>
  <profile:localTransactionId profile:sourceOfId="automatic" /> 
  <profile:parentTransactionId profile:sourceOfId="automatic" /> 
  <profile:globalTransactionId profile:sourceOfId="automatic" /> 
  </profile:eventCorrelation>
  <profile:eventSequence profile:name="creationTime" />
  </profile:eventPointDataQuery>
  <profile:applicationDataQuery>
  <profile:complexContent>
  <profile:payloadQuery profile:queryText="$Body/emp/ename"> 
  </profile:payloadQuery>
  </profile:complexContent>
  </profile:applicationDataQuery> 
  <profile:bitstreamDataQuery profile:bitstreamContent="body" profile:encoding="base64Binary" /> 
  </profile:eventSource>
</profile:monitoringProfile>


Now open IBM Command Console & Issue these commands




Now deploy the flow into the Execution Group & issue this command



Now create a subscription point in the MQ Explorer



Look for result in SUB queue and then we get two messages for Transaction.Start and Transaction.End 

Result:-
Transaction.Start Result:




Transaction.End  Result:



Input:

<emp><eno>1000</eno><ename>Ajay</ename></emp>

No comments: