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 7521657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:17:23+00:00 2026-05-30T02:17:23+00:00

What is the best way to perform initialization on DefaultMessageListenerContainer initialization? Currently I am

  • 0

What is the best way to perform initialization on DefaultMessageListenerContainer initialization? Currently I am waiting for first message, and keep track of it using a boolean variable, which isn’t so pretty. Is there a better way ? I want to read and load certain data into the cache once the Message Driven POJO is started up, so the message processing is faster.

(Edited)

Spring Config Fragement:

<bean id="itemListener" class="com.test.ItemMDPImpl" autowire="byName" />

<bean id="itemListenerAdapter" class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
    <property name="delegate" ref="itemListener" />
    <property name="defaultListenerMethod" value="processItems" />
    <property name="messageConverter" ref="itemMessageConverter" />
</bean>

<bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="connectionFactory" ref="itemMqConnectionFactory" />
    <property name="destinationName" value="${item_queue_name}" />
    <property name="messageListener" ref="itemListenerAdapter" />
    <property name="transactionManager" ref="jtaTransactionManager" />
    <property name="sessionTransacted" value="true" />
    <property name="concurrentConsumers" value="1" />
    <property name="receiveTimeout" value="3000" />
</bean>

I would like to have some initialization done before any message is received by the listener.

  • 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-05-30T02:17:25+00:00Added an answer on May 30, 2026 at 2:17 am

    Can’t you just use @PostConstruct to annotate a method on ItemMDPImpl to perform startup initialization, just like any other Spring bean?

    4.9.6 @PostConstruct and @PreDestroy

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

Sidebar

Related Questions

Using .net XsltCompiled transforms, whats the best way to perform date diffs? Is defining
What is the best way to perform a couple of tasks together and if
I started off by drafting a question: What is the best way to perform
What's the best, crossplatform way to perform blackbox tests on AJAX web applications? Ideally,
What's the best way to perform fulltext searches across rich media files? I'm trying
I was wondering what is the best way to perform a second function after
What is the best way to perform an alphanumeric check on an INPUT field
Which would be the best way to do it? Right now, I convert my
I trying to figure out the best way to perform memory management on the
What is the best way to perform substitutions with re.sub given a list? For

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.