Adds the gateway-specific data, including any message contents, as a Java Map to the CFEvent object
Event Gateway Development
void setData(Map data)
getData, CFML CFEvent structure, "CFEvent class" in the ColdFusion Developer's Guide
Parameter |
Description |
---|---|
data |
The incoming message and any additional gateway-specific event data. |
The number of fields and their contents depend on the event gateway type. The Map keys must be strings.
Because Coldfusion is not case sensitive, it converts the Map passed in the setData method to a case insensitive Map. As a result, do not create entries in the data with names that differ only in case.
The following code shows the routine from the example JMS gateway that handles incoming messages. It puts the JMS message ID and contents in a data HashMap, and uses it in the setData method:
public void handleMessage(String msg, String topicName, String msgID) { coldfusion.eventgateway.Logger log = getGatewayServices().getLogger(); Map data = new HashMap(); CFEvent cfMsg = new CFEvent(getGatewayID()); data.put("msg", msg); data.put("id", msgID); cfMsg.setData(data); cfMsg.setOriginatorID(topicName); cfMsg.setGatewayType("JMS"); if (sendMessage(cfMsg)) { log.info("Added message '" + msgID + "' to queue."); } else { log.error("Failed to add message '" + msgID + "' to queue."); } }