If your client calls message-driven rule beans (MDB) for
asynchronous message processing, you can create a message body that
sets ruleset parameters in a hash map.
About this task
In message-driven rule beans (MDB), the message body
ObjectMessage.setObject(java.io.Serializable) can
also include ruleset parameters in a hash map that is identified by
their name and value. See
(Deprecated) Message-driven rule beans.
Procedure
- Create the JMS object message by using the queue session.
ObjectMessage requestMessage = queueSessionReceiver.createObjectMessage();
- Set the mandatory Rule Execution Server JMS
properties.
requestMessage.setStringProperty("ilog_rules_bres_mdb_rulesetPath", rulesetPath);
requestMessage.setStringProperty("ilog_rules_bres_mdb_status","request");
- Optional: Get a reply message with the result
of the execution.
requestMessage.setJMSReplyTo(replyTo);
- Set the ruleset parameters.
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("customer", customer);
parameters.put("order", order);
requestMessage.setObject(parameters);
- Send the message.
queueSender.send(requestMessage);
Example
Here is the entire code sample:
ObjectMessage requestMessage = queueSessionReceiver.createObjectMessage();
requestMessage.setStringProperty("ilog_rules_bres_mdb_rulesetPath", rulesetPath);
requestMessage.setStringProperty("ilog_rules_bres_mdb_status","request");
requestMessage.setJMSReplyTo(replyTo);
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("customer", customer);
parameters.put("order", order);
requestMessage.setObject(parameters);
queueSender.send(requestMessage);