tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Lutum <>
Subject JMS and peristent messages
Date Mon, 19 Sep 2011 11:16:31 GMT
Hi out there!

I have a question how I can get a JMS Message persistent in the Database.

I am using the following configuration:
(default I think)

<Container id="My MDB Container" type="MESSAGE">
  #  The resource adapter delivers messages to the container
  ResourceAdapter My JMS Resource Adapter

  # Specifies the message listener interface handled by this container
  MessageListenerInterface javax.jms.MessageListener

  # Specifies the activation spec class
  ActivationSpecClass org.apache.activemq.ra.ActiveMQActivationSpec

  # Specifies the maximum number of bean instances that are
  # allowed to exist for each MDB deployment.
  InstanceLimit 10

<Resource id="My JMS Resource Adapter" type="ActiveMQResourceAdapter">
  # Broker configuration URI as defined by ActiveMQ
  # see
  #BrokerXmlConfig xbean:file:conf/activemq.xml
  BrokerXmlConfig broker:(tcp://localhost:61616)?useJmx=false&amp;persistent=true

  # Broker address
  ServerUrl vm://localhost?async=true
  MaximumRedeliveries 10
  InitialRedeliveryDelay 3000

  # DataSource for persistence messages (Links to my HSQL Database)
  DataSource My Unmanaged DataSource

<Connector id="My JMS Connection Factory" type="javax.jms.ConnectionFactory">
  ResourceAdapter My JMS Resource Adapter
  TransactionSupport xa
  PoolMaxSize 10
  PoolMinSize 0
  ConnectionMaxWaitMilliseconds 5000
  ConnectionMaxIdleMinutes 15

Now I try to write messages to a queue using a session bean.

    private ConnectionFactory connectionFactory;

    private Queue testQueue;

            connection = connectionFactory.createConnection();

            // Create a Session
            session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);

            // Create a MessageProducer from the Session to the Topic or Queue
            MessageProducer producer = session.createProducer(testQueue);

            // Create a message
            TextMessage message = session.createTextMessage("test");

            // Tell the producer to send the message

BUT the messages are not backed up by the database.
There is no JMS related Table created and so also no entry is stored.

When I consume the message it works. So it is stored only in memory.
What do I miss?

Markus  Lutum

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message