The "SwiftMQLauncher" bean was introduced with release 7.4.0 and can be used to start a SwiftMQ Router out of Spring intra-VM. This is useful for unit tests. Example:
<bean id ="swiftmqLauncher" class="com.swiftmq.jms.springsupport.SwiftMQLauncher" init-method="startRouter" destroy-method="shutdownRouter">
<property name="workingDir" value="/Users/am/swiftmq_7_3_2/scripts/unix"/>
<property name="configFile" value="../../config/router1/routerconfig.xml"/>
<property name="registerShutdownHook" value="false"/>
</bean>
<bean id="jndiTemplate"
class="org.springframework.jndi.JndiTemplate" depends-on="swiftmqLauncher">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">com.swiftmq.jndi.InitialContextFactoryImpl</prop>
<prop key="java.naming.provider.url">smqp://intravm/timeout=10000</prop>
</props>
</property>
</bean>
<bean id="jmsConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean"
lazy-init="true">
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
</property>
<property name="jndiName">
<value>IVMConnectionFactory</value>
</property>
</bean>
...
If this bean is used to start SwiftMQ intra-VM, it is reasonable to use intra-VM connections, that is, use "intravm" as the host name for the SMQP-URL and lookup an intra-VM connection factory, e.g. "IVMConnectionFactory" as shown above.
The bean has 3 properties. Property "workingDir" must be set to the platform script directory and must be absolute. Property "configFile" is a relative path (relative to "workingDir") and points to the router's config file.
Property "registerShutdownHook" specifies whether the router registers its own shutdown hook. This is not required if the destroy-method is defined AND the Spring application registers a shutdown hook at its application context like this:
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(args[0]);
context.registerShutdownHook();
context.start();
Only in that case Spring runs through the shutdown hook and calls the declared destroy-method. In any other case the property "registerShutdownHook" must be set to true to ensure the SwiftMQ router will be orderly shut down.
The init-method of the bean must be set to "startRouter" which starts the router. The destroy-method must be set to "shutdownRouter".
Keep in mind to depend your other beans on "SwiftMQLauncher" bean.