[jboss-user] [JBoss Messaging] - Re: How to schedule messages?

shrimad do-not-reply at jboss.com
Thu Jun 4 07:05:46 EDT 2009


Hooray!!! Made it! ))


  | <?xml version="1.0" encoding="UTF-8"?>
  | <server>
  |   <mbean code="javax.management.timer.Timer" name="jboss.monitor:name=HereTheName,type=Timer"/>
  | 
  |   <mbean code="org.jboss.monitor.services.TimerService" 
  |        name="jboss.monitor:name=HereTheName,type=TimerService">
  |     <attribute name="NotificationType">jboss.monitor.herethename</attribute>
  |     <attribute name="NotificationMessage">ping!</attribute>
  |     <attribute name="TimerPeriod">10sec</attribute>
  |     <depends optional-attribute-name="TimerMBean">
  |         jboss.monitor:name=HereTheName,type=Timer
  |     </depends>
  |   </mbean>
  | 
  |   <mbean code="org.jboss.monitor.services.ScriptingListener" 
  |        name="jboss.monitor:service=ScriptingListener"> 
  |     <attribute name="SubscriptionList">
  |         <subscription-list>
  |             <mbean name="jboss.monitor:name=HereTheName,type=Timer"/>
  |         </subscription-list>
  |     </attribute>
  | 
  |     <attribute name="ScriptLanguage">beanshell</attribute>
  |     <attribute name="Script">
  |                 <![CDATA[
  |     import javax.naming.InitialContext;
  |     import javax.jms.*;
  | 
  |     InitialContext ctx = new InitialContext();
  |     TopicConnectionFactory tcf = (TopicConnectionFactory)ctx.lookup("ConnectionFactory");
  |     TopicConnection conn = tcf.createTopicConnection();
  |     TopicSession session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
  |     conn.start();
  | 
  |     Topic topic = (Topic)ctx.lookup("topic/HeretheTopicName");
  |     TopicPublisher send = session.createPublisher(topic);
  |     Message m = session.createMessage();
  |     send.publish(m);
  |     send.close();
  |     conn.close();
  |                 ]]>
  |     </attribute>
  |   </mbean>
  | 
  | </server>
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4235264#4235264

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4235264



More information about the jboss-user mailing list