Announcement Announcement Module
Collapse
No announcement yet.
Websphere Scheduler + ActiveMQ + Spring JMS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Websphere Scheduler + ActiveMQ + Spring JMS

    New to JMS and websphere scheduling.....

    I've set up my Spring JMS much like how Mark did in this tutorial.
    http://www.springframework.org/node/527

    Code:
    <bean id="jmsConnectionFactory"
    		class="org.apache.activemq.ActiveMQConnectionFactory"
    		p:brokerURL="tcp://localhost:61616" />
    
    	<bean id="emailQueue"
    		class="org.apache.activemq.command.ActiveMQQueue">
    		<constructor-arg value="queue.email" />
    	</bean>
    <bean id="emailInvokeSender"
    		class="com.abc.def.jms.EmailSender"
    		p:jmsTemplate-ref="jmsTemplate" />
    <bean id="jmsTemplate"
    		class="org.springframework.jms.core.JmsTemplate"
    		p:connectionFactory-ref="jmsConnectionFactory"
    		p:defaultDestination-ref="emailQueue" />
    
    	<bean id="emailListener"
    		class=" org.springframework.jms.listener.adapter.MessageListenerAdapter"
    		p:delegate-ref="emailNotificationService"
    		p:defaultListenerMethod="sendNotificationEmails" />
    <bean
    		class="org.springframework.jms.listener.SimpleMessageListenerContainer"
    		p:destination-ref="emailQueue"
    		p:connectionFactory-ref="jmsConnectionFactory"
    		p:messageListener-ref="emailListener" />
    And I've also set up the websphere scheduler
    (configured scheduler - create db for scheduler)

    I've also written the task that sends a JMS message as specified in the IBM infocenter..... but I think I'm missing the tying link between the scheduler and the actual message sending.

    Code:
    Scheduler scheduler = (Scheduler) new InitialContext().lookup("sched/ABCScheduler");
    			
    			MessageTaskInfo taskInfo = (MessageTaskInfo) scheduler.createTaskInfo(MessageTaskInfo.class);
    			
    			Date startDate = new java.util.Date(System.currentTimeMillis()+30000);
    
    
    
    			taskInfo.setConnectionFactoryJndiName("jms/ActiveMQConnectionFactory");
    			taskInfo.setDestinationJndiName("queue.email");
    			taskInfo.setStartTime(startDate);
    			
    			TaskStatus ts = scheduler.create(taskInfo);
    			System.out.println("Task created with id: " + ts.getTaskId());
    			String taskId = ts.getTaskId();
    The result is the following:
    Code:
    [8/8/08 14:59:21:398 MDT] 0000002b SystemOut     O Task created with id: 104
    [8/8/08 14:59:51:318 MDT] 00000026 AlarmListener E   SCHD0063E: A task with ID 104 failed to run on Scheduler keyeraScheduler (sched/KeyeraScheduler) because of an exception: javax.naming.NameNotFoundException: Context: abcNode04Cell/nodes/abcNode04/servers/server1, name: queue.email: First component in name queue.email not found..
    I can definatly send a message from a test class using the jmsTemplate... but how do we do this with WebSphere scheduler.

    Note: I would love to use Quartz, but I'm not allowed to.

    Any help is appreciated.
    Thanks!
    Last edited by hasdy; Aug 8th, 2008, 04:00 PM.

  • #2
    JNDI integration

    I suppose the problem is that WebSphere scheduler needs a valid JNDI to set in the destinationJNDIName.

    So I guess I have to set up the jndi template in my configs.

    I've taken a look at the activemq (http://activemq.apache.org/spring-support.html) spring/jndi/jms support pages but they seem to have a different spring jms paradigm and not like the Message driven pojos I've got set up (http://www.springframework.org/node/527).

    Does anyone have an example of the message driven pojo configured with JNDI?

    or any references to something like this?

    Thanks!

    Comment

    Working...
    X