|
getData
DescriptionReturns
the data Map that contains the message contents and other gateway-specific
information.
CategoryEvent
Gateway Development
ReturnsThe
event data structure, or null. This structure includes the message
contents being passed by the gateway and any other gateway-specific
information.
UsageThe contents
of the data Map depends on the event gateway type. Typical fields include
the message contents, originator ID, destination ID, and if a gateway (such
as the ColdFusion SMS gateway) supports multiple commands, the command.
Note: The returned Map object has case-insensitive keys.
ExampleThe
following outgoingMessage method from the SocketGateway example gateway
gets the message contents from the CFEvent data field of an outgoing message.
If the CFEvent object does not include an OriginatorID field, it
also tries to get the originator ID from the data field.
public String outgoingMessage(coldfusion.eventgateway.CFEvent cfmsg)
{
String retcode="ok";
// Get the table of data returned from the event handler
Map data = cfmsg.getData();
String message = (String) data.get("MESSAGE");
// find the right socket to write to from the socketRegistry hashtable
if (cfmsg.getOriginatorID() != null)
((SocketServerThread)socketRegistry.get(cfmsg.getOriginatorID())).
writeOutput(message);
else if (data.get("OriginatorID") != null)
((SocketServerThread)socketRegistry.get(data.get("OriginatorID"))).
writeOutput(message);
else {
System.out.println("cannot send outgoing message. OriginatorID is not
available.");
retcode="failed";
}
return retcode;
}
|