JBoss AS and ActiveMQ

I’ve created 22+ minutes screencast about JBoss AS and ActiveMQ integration

In this screencast you’ll learn how to:

  1. Deploy ActiveMQ
  2. Run consumer/supplier samples
  3. Integrate JBoss AS 6 and ActiveMQ
  4. Enqueue TextMessage from EJB using ActiveMQ

Source code for session bean:

package src;

import java.util.Date;

import javax.ejb.Schedule;
import javax.ejb.Stateless;
import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.QueueConnectionFactory;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
import javax.naming.NamingException;

 * Session Bean implementation class MySimplePeriodicalTask
public class MySimplePeriodicalTask {

	 * Default constructor.
	public MySimplePeriodicalTask() {
		System.out.print("MySimplePeriodicalTask() ctor called");

	@Schedule(hour = "*", minute = "*", second = "*/10")
	public void someServerTask() throws JMSException {

		Connection conn = null;
		Session session = null;
		MessageProducer producer = null;
		try {
			InitialContext context = new InitialContext();
			QueueConnectionFactory connFactory = (QueueConnectionFactory) (context

			conn = connFactory.createConnection();

			session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
			Queue queue = session.createQueue(this.getClass().toString()
					+ ".QUEUE");

			producer = session.createProducer(queue);

			String content = (new Date()).toString();
			TextMessage msg = session.createTextMessage(content);


		} catch (NamingException e) {
			// TODO Auto-generated catch block
		} catch (JMSException e) {
			// TODO Auto-generated catch block
		} finally {

		System.out.println("Task has been performed");

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: