If your hunch is correct (about Spring initializing a new context for each
MDB instance) you can try a SingletonBeanFactoryLocator :
http://www.springframework.org/docs/api/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.html

In setMessageDrivenContext, do something like this:

    public void setMessageDrivenContext(MessageDrivenContext messageContext)
throws EJBException {
setBeanFactoryLocator(ContextSingletonBeanFactoryLocator.getInstance());
        setBeanFactoryLocatorKey("myContext");
    }

and you would have a file on the classpath called beanRefContext.xml which
might look like this:

<beans>
  <bean id="myContext"
class="org.springframework.context.support.ClassPathXmlApplicationContext">
    <constructor-arg>
      <list>
        <value>some-beans.xml</value>
        <value>some-more-beans.xml</value>
      </list>
    </constructor-arg>
  </bean>
</beans>

Tim


vineetc wrote:
> 
> Hello, I am trying to use AMQ as a JMS provider and running into problems.
> Need some help understanding the reason(s). 
> 
> ...
> 
> My hunch is that, spring creates and loads AppContext in the MDB for every
> MDB instance that is created and destroyed and this is causing the
> behavior but i am not sure yet. Any help is appreciated. 
> 
> Thanks, Vineet
> 

-- 
View this message in context: 
http://www.nabble.com/Problems-Recv.-Messages-on-MDB-tf3549628s2354.html#a9910967
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to