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 Topic Request With No Reply

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

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

To invoke a topic request with no reply:

  1. Enable the client to locate the topic connection factory and topic:
TopicConnectionFactory topicConnectionFactory =
 (TopicConnectionFactory) jndiContext.lookup("jms/
                             BRESTopicConnectionFactory");
Topic topic = (Topic) jndiContext.lookup("jms/BRESTopic");
  1. Get the client to create the topic connection and topic session:
topicConnection = topicConnectionFactory.createTopicConnection();
topicSession = topicConnection.createTopicSession(false,
               Session.AUTO_ACKNOWLEDGE);
  1. Get the client to send a message to the topic.
String rulesetPath = "/simplexml/simplexmlruleset";
String userData = "Topic simple xml";
 
// Create Publisher.
TopicPublisher publisher = topicSession.createPublisher(topic);
 
// Create Message.
ObjectMessage requestMessage = topicSession.createObjectMessage();
 
// Set mandatory JMS properties.
requestMessage.setStringProperty("ilog_rules_bres_mdb_rulesetPath", rulesetPath);
requestMessage.setStringProperty("ilog_rules_bres_mdb_status","request");
 
// Optional
requestMessage.setStringProperty("ilog_rules_bres_mdb_userData", userData);
 
HashMap parameters = new HashMap();
parameters.put("param1","<?xml ... >");
requestMessage.setObject(parameters);
 
// Send Message.
publisher.publish(requestMessage);
 
// Close publisher.
publisher.close();
  1. Close the session and connection:
topicSession.close();
topicConnection.close();

Related Concepts

Message-Driven Rule Beans

Related Tasks

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

Related Samples and Tutorials

How to Use a Message-Driven Rule Bean