This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.commons.httpclient.HttpClient; | |
import org.apache.commons.httpclient.HttpStatus; | |
import org.apache.commons.httpclient.cookie.CookiePolicy; | |
import org.apache.commons.httpclient.methods.PostMethod; | |
import org.apache.commons.httpclient.methods.multipart.*; | |
import org.apache.commons.httpclient.params.HttpMethodParams; | |
import org.mule.api.MuleEventContext; | |
import org.mule.api.MuleMessage; | |
import org.mule.api.lifecycle.Callable; | |
import org.mule.util.IOUtils; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ObjectStoreManager objectStoreManager = ((ObjectStoreManager) | |
muleContext.getRegistry().get(MuleProperties.OBJECT_STORE_MANAGER)); | |
ObjectStore objectStore = objectStoreManager.getObjectStore(MuleProperties.OBJECT_STORE_DEFAULT_IN_MEMORY_NAME); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping(method = RequestMethod.POST) | |
public void save(@RequestBody Product product) throws Exception { | |
muleClient.dispatch("vm://products", product, null); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<flow name="submitAndAuditProductDefinitions"> | |
<vm:inbound-endpoint path="products" exchange-pattern="one-way"/> | |
<all> | |
<jms:outbound-endpoint queue="products" exchange-pattern="one-way"/> | |
<http:outbound-endpoint host="api.acmesoft.com" port="80" path="productAudit" | |
exchange-pattern="one-way"/> | |
</all> | |
</flow> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ResponseBody | |
@RequestMapping(method = RequestMethod.POST) | |
public Product save(@RequestBody Product product) throws Exception { | |
MuleMessage response = muleClient.send("jms://products", product, null, 2000); | |
if (response == null || response.getPayload() instanceof NullPayload) { | |
throw new InvalidProductResponseException(); | |
} else { | |
return (Product) response.getPayload(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping(method = RequestMethod.POST) | |
public void save(@RequestBody Product product) throws Exception { | |
muleClient.dispatch("jms://products", product, null); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping("/products") | |
@Controller | |
public class ProductController { | |
@Autowired | |
MuleClient muleClient; | |
@RequestMapping(method = RequestMethod.POST) | |
public void save(@RequestBody Product product) throws Exception { | |
// ToDo implement code to dispatch to JMS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean name="muleClient" class="org.mule.module.client.MuleClient" scope="singleton"> | |
<constructor-arg value="META-INF/mule/mule-config.xml"/> | |
</bean> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<mule xmlns="http://www.mulesoft.org/schema/mule/core" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:vm="http://www.mulesoft.org/schema/mule/vm" | |
xmlns:context="http://www.springframework.org/schema/context" | |
xmlns:spring="http://www.springframework.org/schema/beans" | |
xmlns:jms="http://www.mulesoft.org/schema/mule/jms" | |
xmlns:mule-xml="http://www.mulesoft.org/schema/mule/xml" | |
xsi:schemaLocation=" | |
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<spring:beans> | |
<spring:bean name="copyInboundToOutboundPropertiesTransformer" class="org.mule.transformer.TransformerTemplate" doc:name="Bean"> | |
<spring:constructor-arg> | |
<spring:bean class="org.mule.pattern.core.support.CopyInboundToOutboundPropertiesTransformerCallback"/> | |
</spring:constructor-arg> | |
</spring:bean> |