Question

I'm using spring integration to create multiple services (each running in their own JVM) with JMS endpoints.

Once retry, exception handling, etc is added, the configuration is no longer trivial. I have moved the spring integration into its own context file and import it in all services to have a consistent setup.

eg

<import resource="classpath:/spring/jmsEndpoint.xml"/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="properties">
        <props>
            <prop key="queueName">myServiceQueue</prop>
        </props>
    </property>
</bean>

<alias name="myBusinessLogic" alias="abstractJmsEndpoint"/>
<bean id="myBusinessLogic" class="..."/>

This configuration allows me to keep each individual service configuration simple, only requiring an override of an abstract bean and setting a few properties.

The problem is I now want multiple jms endpoints in the same service (jvm). As I can't import jmsEndpoint.xml multiple times, what is the best way to reuse the configuration?

Was it helpful?

Solution

See the dynamic-ftp sample - it uses a technique of creating instances of a parameterized application contexts, passing different properries into each. It's README also has links to forum discussions about how to make these contexts children of the main context, in cases where the child needs access to shared resources.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top