ILOG JRules User Guide > Executing Rules > Tasks > Executing a Ruleset Using Rule Execution Server > Invoking a Ruleset Using a Message-Driven Rule Bean > Invoking a Queue Request With No Reply

To use the JRules message-driven rule bean in a queue request with no reply, you must have the following:

A message client sends messages to the queue that the message-bean listens to.

To invoke a queue request with no reply:

  1. Enable the client to locate the connection factory and queue:
QueueConnectionFactory queueConnectionFactory =
 (QueueConnectionFactory) jndiContext.lookup("jms/
                                BRESQueueConnectionFactory");
Queue queueIn = (Queue) jndiContext.lookup("jms/BRESQueueIn");
  1. Get the client to create the queue connection and session:
queueConnection = queueConnectionFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false,
               Session.AUTO_ACKNOWLEDGE);
  1. Get the client to send a message to the queue.
  2. A client can send a message containing a single parameter that takes an XML schema as its value, as follows:
// Create a sender to the JMS Queue that listens to the MDB.
QueueSender queueSender = queueSession.createSender(queueIn);
 
// Create the JMS Object Message.
ObjectMessage oMessage = queueSession.createObjectMessage();
String rulesetPath = "/simplexml/simplexmlruleset";
String userData = "Queue with XML parameter";
 
// Set mandatory JMS properties.
oMessage.setStringProperty("ilog_rules_bres_mdb_rulesetPath", rulesetPath);
oMessage.setStringProperty("ilog_rules_bres_mdb_status","request");
 
// Optional
oMessage.setStringProperty("ilog_rules_bres_mdb_userData", userData);
 
HashMap parameters = new HashMap();
parameters.put("paramXml","<?xml ... >");
oMessage.setObject(parameters); 
 
// Send
queueSender.send(oMessage);
 
// Close the sender.
queueSender.close();
  1. Close the session and connection:
queueSession.close();
queueConnection.close();

Related Concepts

Message-Driven Rule Beans

Related Tasks

Invoking a Queue Request With a Reply
Invoking a Topic Request With No Reply

Related Samples and Tutorials

How to Use a Message-Driven Rule Bean