Message format and error messages for the IBM MQ Bridge to Salesforce

Information on formatting of the messages that are processed by the IBM MQ Bridge to Salesforce.

An application puts a message to a specific queue manager topic, for example /root/mqtosfb/event/MQPlatformEvent1__e. The bridge subscribes to the topic, gets content from the messages, and uses it to publish event messages for a Salesforce platform event.

We need to create a platform event in Salesforce and define the content fields before we can use the bridge to create event messages for that platform event. The platform event name and its contents determine how we need to format the IBM MQ message that is processed by the bridge. For example, if your Salesforce platform event Object name is MQPlatformEvent1 and your two custom defined fields are text fields with the API name MyText__c and Name__c, then the IBM MQ message that is published on the /root/mqtosfb/event/MQPlatformEvent1__e topic must be a correctly formatted JSON, as follows:
{ "MyText__c" : "Some text here", "Name__c" : "Bob Smith" }

The messages that are consumed and produced by the bridge are text (MQSTR) messages in JSON format. The input message is a simple JSON and programs can use string concatenation to generate it.


Error messages

Errors can be detected by the bridge, for example if the message is not in text format or by Salesforce, for example if the platform event name does not exist. If an error occurs in processing the input message, the message is moved to the bridge error queue along with the properties that describe the error. The error is also written to the stderr stream for the bridge.

Errors that are generated by Salesforce are JSON. The following are some errors that are caused by incorrectly formatted messages:

Bad platform event contents, status 400 Text
[{"message":"No such column 'Name__c' on sobject of type MQPlatformEvent2__e","errorCode":"INVALID_FIELD"}
Invalid platform event name, status 404 text
{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}
Bad JSON, status 400 text
{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}
Message is not JSON, status 400 text
[{"message":
  "Unexpected character ('h' (code 104)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [line:1, column:2]",
  "errorCode":"JSON_PARSER_ERROR"}
Not a text message (not sent to Salesforce)
Error: Publication on topic ' /sf/mqtosfb/event/MQPlatformEvent1' does not contain a text formatted message
Parent topic: Create event messages for Salesforce platform events