Mule : Embedding Mule in a Webapp
This page last changed on May 31, 2006 by tcarlson.
To embed Mule inside your webapp you will need to provide one or more configuration file locations as context params and you will need to include a context listener to initilize the Mule Server. If you are using the Mule Xml configuration use the followng - <context-param> <param-name>org.mule.config</param-name> <param-value>/WEB-INF/mule-config-main.xml,/WEB-INF/mule-components.xml</param-value> </context-param> <listener> <listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class> </listener> The configuration param can either be a classpath location of file location. You can also specify multiple configuration files and these can be on the classpath or on the file system. To use Spring configuration you can use the standard Spring context listener <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/mule-spring-config.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> Again the configration files can be on the classpath or file system and you can specify a comma separated list. To interact with the Mule server from you Jsps or servlets you can use the Mule Client. //create a client MuleClient client = new MuleClient(); //send a jms message asynchronously client.dispatch("jms://my.queue", "some data", null); //or to receive a pop3 message via a configured mailbox UMOMessage message = client.receive("pop3://ross:secret@mail.mycompany.com", 3000); //or synchonous send a inter-vm message UMOMessage message2 = client.send("vm://my.object", "Some more data", null); |
![]() |
Document generated by Confluence on Oct 03, 2006 09:23 |