Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9140963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:35:05+00:00 2026-06-17T09:35:05+00:00

I am using HornetQ as a queue provider as it has persistence capabilities. However,

  • 0

I am using HornetQ as a queue provider as it has persistence capabilities. However, after I restart the application, all the messages in the queue are lost. Maybe configuration issues?

Here is the code:

// Step 1. Create the Configuration, and set the properties accordingly
Configuration configuration = new ConfigurationImpl();
configuration.setPersistenceEnabled(true);
configuration.setPersistIDCache(true);
configuration.setJMXManagementEnabled(true);
configuration.setMessageCounterEnabled(true);
configuration.setPersistDeliveryCountBeforeDelivery(true);
configuration.setSecurityEnabled(false);
configuration.setJournalSyncTransactional(true);
configuration.setJournalSyncNonTransactional(true);
configuration.setJournalType(JournalType.NIO);

HashSet<TransportConfiguration> transports = new HashSet<TransportConfiguration>();

transports.add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
    configuration.setAcceptorConfigurations(transports);

// Step 2. Create and start the server
eServer = new EmbeddedHornetQ();
eServer.setConfiguration(configuration);
eServer.start();

// Step 3. As we are not using a JNDI environment we instantiate the objects irectly
ServerLocator serverLocator = HornetQClient.createServerLocatorWithHA(new TransportConfiguration(NettyConnectorFactory.class.getName()), new TransportConfiguration(InVMConnectorFactory.class.getName()));
sessionFactory = serverLocator.createSessionFactory();

// Step 4. Create a core queue
coreSession = sessionFactory.createSession(true, true, true);
QueueQuery qq = coreSession.queueQuery(SimpleString.toSimpleString(QUEUE_NAME));
if(!qq.isExists()) coreSession.createQueue(QUEUE_NAME, QUEUE_NAME, true);
coreSession.close();

// Step 5. Create the session, and the producer
session = sessionFactory.createSession();
producer = session.createProducer(QUEUE_NAME);

// Step 6. Create the message consumer and set a listener
ClientConsumer messageConsumer = session.createConsumer(QUEUE_NAME);
messageConsumer.setMessageHandler(new QueueListener(session, producer));

// Step 7. Start the connection.
session.start();

// ...

// put 50,000 messages into the queue

// ...

session.close();
sessionFactory.close();
eServer.stop();

I have also tried to print the journal files, but the message count is always 0:

JournalStorageManager.describeMessagesJournal(journalDirectory);
#JournalFileImpl: (hornetq-data-1.hq id = 209, recordID = 209)
#JournalFileImpl: (hornetq-data-2.hq id = 210, recordID = 210)
#JournalFileImpl: (hornetq-data-3.hq id = 211, recordID = 211)
#JournalFileImpl: (hornetq-data-4.hq id = 212, recordID = 212)
#JournalFileImpl: (hornetq-data-9.hq id = 213, recordID = 213)
#JournalFileImpl: (hornetq-data-10.hq id = 214, recordID = 214)
#JournalFileImpl: (hornetq-data-17.hq id = 215, recordID = 215)
#JournalFileImpl: (hornetq-data-18.hq id = 216, recordID = 216)
#JournalFileImpl: (hornetq-data-35.hq id = 217, recordID = 217)
#JournalFileImpl: (hornetq-data-36.hq id = 218, recordID = 218)
#JournalFileImpl: (hornetq-data-57.hq id = 219, recordID = 219)
#JournalFileImpl: (hornetq-data-58.hq id = 220, recordID = 220)
#JournalFileImpl: (hornetq-data-71.hq id = 221, recordID = 221)
#JournalFileImpl: (hornetq-data-72.hq id = 222, recordID = 222)
#JournalFileImpl: (hornetq-data-73.hq id = 223, recordID = 223)
#JournalFileImpl: (hornetq-data-74.hq id = 224, recordID = 224)
#JournalFileImpl: (hornetq-data-187.hq id = 225, recordID = 225)
#JournalFileImpl: (hornetq-data-188.hq id = 226, recordID = 226)
#JournalFileImpl: (hornetq-data-207.hq id = 227, recordID = 227)
#JournalFileImpl: (hornetq-data-208.hq id = 228, recordID = 228)

### Surviving Records Summary ###

### Prepared TX ###

### Message Counts ###
message count=0
message reference count
prepared message count=0
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:35:06+00:00Added an answer on June 17, 2026 at 9:35 am

    Thanks for Mr.Andy Taylor at HornetQ User Forum for his answer. The problem was with creating not-persistent messages, like:

    ClientMessage cMessage = session.createMessage(false);
    

    I just change it to true, and it’s working well now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using JBoss AS 5 + 6 as an application server, however only
HornetQ by default is using file system and it's own Journals for persistence ,
Is it possible to send message to particular receiver using JMS Queue(HornetQ)? Among so
There's an Arquillian integration test using JMS HornetQ with persisted messages. Some test leave
I'm trying running JMS application using hornetq on tomcat! I tried following this article
Using the Redis info command, I am able to get all the stats of
Using System.Diagnostics.EventLog .NET type one can programmatically create logs into the Event Viewer application.
Using: HornetQ 2.0.0.CR2 Default configurations for the stand-alone/non-clustered server. When I try to startup
I am using HornetQ with JBoss6 in Linux OS, Can anybody tell me How
I am using Hornetq 2.0 i dont understand how can i know how many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.