Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Examples upgraded to Mule 3.0.x

  • Loading branch information...
commit b3e65c80a459141e6be1548fc2a5228d07594260 1 parent e9fce5c
john.demic authored
Showing with 81 additions and 69 deletions.
  1. +5 −1 chapter03/cxf/conf/cxf-jaxws-config.xml
  2. +6 −2 chapter03/cxf/conf/cxf-simple-config.xml
  3. +1 −4 chapter03/cxf/conf/cxf-wsdl-config.xml
  4. +6 −1 chapter03/cxf/pom.xml
  5. +3 −3 chapter03/file/conf/file-config.xml
  6. +4 −4 chapter03/file/conf/file-xml-filter-config.xml
  7. +2 −2 chapter03/http/conf/http-inbound-config.xml
  8. +8 −7 chapter03/http/conf/http-outbound-config.xml
  9. +3 −2 chapter03/http/conf/http-polling-config.xml
  10. +6 −5 chapter03/imap/conf/imap-config.xml
  11. +2 −2 chapter03/imap/conf/imap-jdbc-config.xml
  12. +5 −8 chapter03/imap/src/test/java/com/muleinaction/AbstractEmailFunctionalTestCase.java
  13. +1 −1  chapter03/jdbc/conf/jdbc-inbound-config.xml
  14. +4 −5 chapter03/jdbc/conf/jdbc-outbound-config.xml
  15. +5 −7 chapter03/jdbc/src/test/java/com/muleinaction/AbstractEmailFunctionalTestCase.java
  16. +1 −1  chapter03/jms/conf/jms-outbound-config.xml
  17. +2 −1  chapter03/jms/conf/jms-remote-sync-config.xml
  18. +6 −3 chapter03/smtp/conf/smtp-config.xml
  19. +5 −7 chapter03/smtp/src/test/java/com/muleinaction/AbstractEmailFunctionalTestCase.java
  20. +0 −1  chapter03/stdio/conf/stdio-config.xml
  21. +3 −1 chapter03/xmpp/conf/xmpp-inbound-config.xml
  22. +3 −1 chapter03/xmpp/conf/xmpp-outbound-config.xml
6 chapter03/cxf/conf/cxf-jaxws-config.xml
View
@@ -5,19 +5,23 @@
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xm="http://www.mulesoft.org/schema/mule/xml"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
+ xmlns:http="http://www.mulesoft.org/schema/mule/http"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.0/mule-xml.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.0/mule-cxf.xsd
+ http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.0/mule-http.xsd
"
>
<model name="cxfJaxwsModel">
<service name="cxfJaxwsService">
<inbound>
- <cxf:inbound-endpoint frontend="jaxws" address="http://localhost:9781/greeting"/>
+ <http:inbound-endpoint address="http://localhost:9781/greeting">
+ <cxf:jaxws-service/>
+ </http:inbound-endpoint>
</inbound>
<component class="com.muleinaction.cxf.jaxws.GreetingServiceImpl"/>
</service>
8 chapter03/cxf/conf/cxf-simple-config.xml
View
@@ -5,19 +5,23 @@
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xm="http://www.mulesoft.org/schema/mule/xml"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
+ xmlns:http="http://www.mulesoft.org/schema/mule/http"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.0/mule-xml.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.0/mule-cxf.xsd
+ http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.0/mule-http.xsd
"
>
-
+
<model name="cxfSimpleModel">
<service name="cxfSimpleService">
<inbound>
- <cxf:inbound-endpoint frontend="simple" address="http://localhost:9781/greeting"/>
+ <http:inbound-endpoint address="http://localhost:9781/greeting">
+ <cxf:simple-service/>
+ </http:inbound-endpoint>
</inbound>
<component class="com.muleinaction.cxf.simple.GreetingServiceImpl"/>
</service>
5 chapter03/cxf/conf/cxf-wsdl-config.xml
View
@@ -26,12 +26,9 @@
<inbound>
<stdio:inbound-endpoint system="IN" exchange-pattern="request-response"/>
</inbound>
- <bridge-component/>
<outbound>
<chaining-router>
- <outbound-endpoint
-address="wsdl-cxf:http://www.webservicex.net/stockquote.asmx?
-WSDL&amp;method=GetQuote"/>
+ <outbound-endpoint address="wsdl-cxf:http://www.webservicex.net/stockquote.asmx?WSDL&amp;method=GetQuote"/>
<stdio:outbound-endpoint system="OUT"/>
</chaining-router>
</outbound>
7 chapter03/cxf/pom.xml
View
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -19,6 +20,10 @@
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
+ <artifactId>mule-transport-http</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mule.transports</groupId>
<artifactId>mule-transport-stdio</artifactId>
</dependency>
</dependencies>
6 chapter03/file/conf/file-config.xml
View
@@ -18,7 +18,7 @@
<file:connector name="FileConnector"
streaming="false"
autoDelete="true"
- pollingFrequency="1000">
+ pollingFrequency="15000">
<file:expression-filename-parser/>
</file:connector>
@@ -29,8 +29,8 @@
</inbound>
<outbound>
<pass-through-router>
- <file:outbound-endpoint path="./data/archive"
- outputPattern="SNAPSHOT-#[function:dateStamp].bak"/>
+ <file:outbound-endpoint path="./data/archive"
+ outputPattern="SNAPSHOT-[function:dateStamp].bak"/>
</pass-through-router>
</outbound>
</service>
8 chapter03/file/conf/file-xml-filter-config.xml
View
@@ -18,7 +18,7 @@
<file:connector name="FileConnector"
streaming="false"
autoDelete="true"
- pollingFrequency="1000">
+ pollingFrequency="15000">
<file:expression-filename-parser/>
</file:connector>
@@ -28,12 +28,12 @@
<file:inbound-endpoint path="./data/snapshot">
<file:filename-wildcard-filter pattern="SNAPSHOT*.xml"/>
</file:inbound-endpoint>
-
+ <idempotent-receiver-router idExpression="#[header:OUTBOUND:originalFilename]"/>
</inbound>
<outbound>
<pass-through-router>
- <file:outbound-endpoint path="./data/archive"
- outputPattern="[header:originalFilename]-[function:dateStamp].xml"/>
+ <file:outbound-endpoint path="./data/archive"
+ outputPattern="[header:OUTBOUND:originalFilename]-[function:dateStamp].xml"/>
</pass-through-router>
</outbound>
</service>
4 chapter03/http/conf/http-inbound-config.xml
View
@@ -25,12 +25,12 @@
<service name="httpInboundService">
<inbound>
<http:inbound-endpoint address="http://${http.host}:${http.port}/backup-reports">
- <byte-array-to-string-transformer/>
+ <byte-array-to-string-transformer/>
</http:inbound-endpoint>
</inbound>
<outbound>
<pass-through-router>
- <file:outbound-endpoint path="./data/reports"
+ <file:outbound-endpoint path="./data/reports"
outputPattern="backup-report-#[function:dateStamp].xml"/>
</pass-through-router>
</outbound>
15 chapter03/http/conf/http-outbound-config.xml
View
@@ -17,11 +17,11 @@
<notifications dynamic="true">
<notification event="ENDPOINT-MESSAGE"/>
</notifications>
-
- <file:connector name="FileConnector"
- streaming="false"
- autoDelete="false"
- pollingFrequency="300000" />
+
+ <file:connector name="FileConnector"
+ streaming="false"
+ autoDelete="false"
+ pollingFrequency="300000"/>
<global-property name="http.host" value="localhost"/>
<global-property name="http.port" value="9765"/>
@@ -44,12 +44,13 @@
<service name="httpInboundService">
<inbound>
<http:inbound-endpoint address="http://${http.host}:${http.port}/backup-reports">
- <byte-array-to-string-transformer/>
+ <byte-array-to-string-transformer/>
</http:inbound-endpoint>
</inbound>
<outbound>
<pass-through-router>
- <file:outbound-endpoint path="./data/reports" outputPattern="backup-report-#[function:datestamp].xml"/>
+ <file:outbound-endpoint path="./data/reports"
+ outputPattern="backup-report-#[function:datestamp].xml"/>
</pass-through-router>
</outbound>
</service>
5 chapter03/http/conf/http-polling-config.xml
View
@@ -26,13 +26,14 @@
<service name="httpPollingService">
<inbound>
<http:inbound-endpoint address="http://${http.host}?connector=pollingHttp">
- <byte-array-to-string-transformer/>
+ <byte-array-to-string-transformer/>
</http:inbound-endpoint>
</inbound>
<outbound>
<pass-through-router>
- <file:outbound-endpoint path="./data/polling" outputPattern="www.cnn.com-#[function:datestamp].html"/>
+ <file:outbound-endpoint path="./data/polling"
+ outputPattern="www.cnn.com-#[function:datestamp].html"/>
</pass-through-router>
</outbound>
</service>
11 chapter03/imap/conf/imap-config.xml
View
@@ -5,7 +5,6 @@
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:imap="http://www.mulesoft.org/schema/mule/imap"
xmlns:email="http://www.mulesoft.org/schema/mule/email"
- xmlns:xm="http://www.mulesoft.org/schema/mule/xml"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
@@ -19,7 +18,7 @@
<global-property name="imap.port" value="65434"/>
<global-property name="imap.user" value="bob"/>
<global-property name="imap.password" value="password"/>
-
+
<notifications dynamic="true">
<notification event="ENDPOINT-MESSAGE"/>
</notifications>
@@ -30,13 +29,15 @@
<inbound>
<imap:inbound-endpoint host="${imap.host}" port="${imap.port}" user="${imap.user}"
- password="${imap.password}" >
- <email:email-to-string-transformer/>
+ password="${imap.password}">
+ <email:email-to-string-transformer/>
</imap:inbound-endpoint>
</inbound>
<outbound>
<pass-through-router>
- <file:outbound-endpoint path="./data/out" outputPattern="EMAIL-#[function:datestamp].txt"/>
+ <file:outbound-endpoint path="./data/out"
+ outputPattern="EMAIL-#[function:datestamp].txt"
+ />
</pass-through-router>
</outbound>
</service>
4 chapter03/imap/conf/imap-jdbc-config.xml
View
@@ -42,13 +42,13 @@
<imap:inbound-endpoint host="${imap.host}" user='${imap.user}'
port="${imap.port}"
password="${imap.password}">
- <email:email-to-string-transformer/>
+ <email:email-to-string-transformer/>
</imap:inbound-endpoint>
</inbound>
<component class="com.clood.monitoring.URLAlertComponent"/>
<outbound>
<pass-through-router>
- <jdbc:outbound-endpoint queryKey="statsInsert"/>
+ <jdbc:outbound-endpoint queryKey="statsInsert" exchange-pattern="one-way"/>
</pass-through-router>
</outbound>
</service>
13 chapter03/imap/src/test/java/com/muleinaction/AbstractEmailFunctionalTestCase.java
View
@@ -10,26 +10,23 @@
package com.muleinaction;
+import com.icegreen.greenmail.util.GreenMail;
+import com.icegreen.greenmail.util.ServerSetup;
import org.mule.api.MuleMessage;
import org.mule.module.client.MuleClient;
import org.mule.tck.FunctionalTestCase;
import org.mule.transport.email.ImapConnector;
import org.mule.transport.email.Pop3Connector;
-import com.icegreen.greenmail.util.GreenMail;
-import com.icegreen.greenmail.util.ServerSetup;
-
-import java.io.IOException;
-
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
+import java.io.IOException;
public abstract class AbstractEmailFunctionalTestCase extends FunctionalTestCase {
protected static final String CONFIG_BASE = "-functional-test.xml";
protected static final long DELIVERY_DELAY_MS = 1000L;
- protected static final boolean MIME_MESSAGE = true;
protected static final boolean STRING_MESSAGE = false;
protected static final String DEFAULT_EMAIL = "bob@example.com";
@@ -92,7 +89,7 @@ protected void doSend() throws Exception {
msg = message;
}
- MuleClient client = new MuleClient();
+ MuleClient client = new MuleClient(muleContext);
client.send("vm://send", msg, null);
server.waitForIncomingEmail(DELIVERY_DELAY_MS, 1);
@@ -121,7 +118,7 @@ protected void verifyMessage(String receivedText) {
protected void doRequest() throws Exception {
assertEquals(1, server.getReceivedMessages().length);
- MuleClient client = new MuleClient();
+ MuleClient client = new MuleClient(muleContext);
MuleMessage message = client.request("vm://receive", 5000);
assertNotNull(message);
2  chapter03/jdbc/conf/jdbc-inbound-config.xml
View
@@ -40,7 +40,7 @@
</inbound>
<outbound>
<pass-through-router>
- <vm:outbound-endpoint address="vm://orders"/>
+ <vm:outbound-endpoint address="vm://orders" exchange-pattern="one-way"/>
</pass-through-router>
</outbound>
</service>
9 chapter03/jdbc/conf/jdbc-outbound-config.xml
View
@@ -25,14 +25,13 @@
<global-property name="imap.password" value="password"/>
<notifications dynamic="true">
- <notification event="ENDPOINT-MESSAGE"/>
- </notifications>
+ <notification event="ENDPOINT-MESSAGE"/>
+ </notifications>
<spring:beans>
<spring:import resource="spring-config.xml"/>
</spring:beans>
-
<jdbc:connector name="jdbcConnector" dataSource-ref="dataSource">
<jdbc:query key="alertInsert"
value="insert into alerts values (0,'esb01',#[payload:java.lang.String],CURRENT_TIMESTAMP)"/>
@@ -44,12 +43,12 @@
<imap:inbound-endpoint host="${imap.host}" user='${imap.user}'
port="${imap.port}"
password="${imap.password}">
- <email:email-to-string-transformer/>
+ <email:email-to-string-transformer/>
</imap:inbound-endpoint>
</inbound>
<outbound>
<pass-through-router>
- <jdbc:outbound-endpoint queryKey="alertInsert"/>
+ <jdbc:outbound-endpoint queryKey="alertInsert" exchange-pattern="one-way"/>
</pass-through-router>
</outbound>
</service>
12 chapter03/jdbc/src/test/java/com/muleinaction/AbstractEmailFunctionalTestCase.java
View
@@ -10,20 +10,18 @@
package com.muleinaction;
+import com.icegreen.greenmail.util.GreenMail;
+import com.icegreen.greenmail.util.ServerSetup;
import org.mule.api.MuleMessage;
import org.mule.module.client.MuleClient;
import org.mule.tck.FunctionalTestCase;
import org.mule.transport.email.ImapConnector;
import org.mule.transport.email.Pop3Connector;
-import com.icegreen.greenmail.util.GreenMail;
-import com.icegreen.greenmail.util.ServerSetup;
-
-import java.io.IOException;
-
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
+import java.io.IOException;
public abstract class AbstractEmailFunctionalTestCase extends FunctionalTestCase {
@@ -92,7 +90,7 @@ protected void doSend() throws Exception {
msg = message;
}
- MuleClient client = new MuleClient();
+ MuleClient client = new MuleClient(muleContext);
client.send("vm://send", msg, null);
server.waitForIncomingEmail(DELIVERY_DELAY_MS, 1);
@@ -121,7 +119,7 @@ protected void verifyMessage(String receivedText) {
protected void doRequest() throws Exception {
assertEquals(1, server.getReceivedMessages().length);
- MuleClient client = new MuleClient();
+ MuleClient client = new MuleClient(muleContext);
MuleMessage message = client.request("vm://receive", 5000);
assertNotNull(message);
2  chapter03/jms/conf/jms-outbound-config.xml
View
@@ -28,7 +28,7 @@
<service name="jmsOutboundService">
<inbound>
<http:inbound-endpoint address="http://${http.host}:${http.port}/backup-reports">
- <byte-array-to-string-transformer/>
+ <byte-array-to-string-transformer/>
</http:inbound-endpoint>
</inbound>
<outbound>
3  chapter03/jms/conf/jms-remote-sync-config.xml
View
@@ -24,7 +24,8 @@
<model name="jmsRemoteSyncModel">
<service name="jmsRemoteSyncService">
<inbound>
- <http:inbound-endpoint address="http://localhost:9765/orders" exchange-pattern="request-response" method="GET"/>
+ <http:inbound-endpoint address="http://localhost:9765/orders" exchange-pattern="request-response"
+ method="GET"/>
</inbound>
<outbound>
<pass-through-router>
9 chapter03/smtp/conf/smtp-config.xml
View
@@ -36,9 +36,12 @@
</inbound>
<outbound>
<pass-through-router>
- <smtp:outbound-endpoint host="${smtp.host}" port="${smtp.port}" from="${smtp.from}" subject="Accounting Invoice"
- to="${smtp.to}">
- <email:string-to-email-transformer/>
+ <smtp:outbound-endpoint host="${smtp.host}"
+ port="${smtp.port}"
+ from="${smtp.from}"
+ subject="Accounting Invoice"
+ to="${smtp.to}" >
+ <email:string-to-email-transformer/>
</smtp:outbound-endpoint>
</pass-through-router>
</outbound>
12 chapter03/smtp/src/test/java/com/muleinaction/AbstractEmailFunctionalTestCase.java
View
@@ -10,20 +10,18 @@
package com.muleinaction;
+import com.icegreen.greenmail.util.GreenMail;
+import com.icegreen.greenmail.util.ServerSetup;
import org.mule.api.MuleMessage;
import org.mule.module.client.MuleClient;
import org.mule.tck.FunctionalTestCase;
import org.mule.transport.email.ImapConnector;
import org.mule.transport.email.Pop3Connector;
-import com.icegreen.greenmail.util.GreenMail;
-import com.icegreen.greenmail.util.ServerSetup;
-
-import java.io.IOException;
-
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
+import java.io.IOException;
public abstract class AbstractEmailFunctionalTestCase extends FunctionalTestCase {
@@ -92,7 +90,7 @@ protected void doSend() throws Exception {
msg = message;
}
- MuleClient client = new MuleClient();
+ MuleClient client = new MuleClient(muleContext);
client.send("vm://send", msg, null);
server.waitForIncomingEmail(DELIVERY_DELAY_MS, 1);
@@ -121,7 +119,7 @@ protected void verifyMessage(String receivedText) {
protected void doRequest() throws Exception {
assertEquals(1, server.getReceivedMessages().length);
- MuleClient client = new MuleClient();
+ MuleClient client = new MuleClient(muleContext);
MuleMessage message = client.request("vm://receive", 5000);
assertNotNull(message);
1  chapter03/stdio/conf/stdio-config.xml
View
@@ -21,7 +21,6 @@
<inbound>
<stdio:inbound-endpoint system="IN"/>
</inbound>
- <bridge-component/>
<outbound>
<pass-through-router>
<stdio:outbound-endpoint system="OUT"/>
4 chapter03/xmpp/conf/xmpp-inbound-config.xml
View
@@ -13,10 +13,12 @@
"
>
+ <xmpp:connector name="xmppConnector" user="muleinaction@jabber.org" password="manning" host="jabber.org"/>
+
<model name="xmppInboundModel">
<service name="xmppInboundService">
<inbound>
- <xmpp:inbound-endpoint user="mule" password="secret" host="jabber.org" recipient="mule"/>
+ <xmpp:inbound-endpoint recipient="mule" />
</inbound>
<!--
<outbound>
4 chapter03/xmpp/conf/xmpp-outbound-config.xml
View
@@ -12,6 +12,8 @@
http://www.mulesoft.org/schema/mule/xmpp http://www.mulesoft.org/schema/mule/xmpp/3.0/mule-xmpp.xsd"
>
+ <xmpp:connector name="xmppConnector" user="muleinaction@jabber.org" password="manning" host="jabber.org"/>
+
<jms:activemq-connector name="jmsConnector" specification="1.1" brokerURL="vm://localhost"/>
<model name="xmppOutboundModel">
@@ -21,7 +23,7 @@
</inbound>
<outbound>
<pass-through-router>
- <xmpp:outbound-endpoint user="mule" password="secret" host="jabber.org" recipient="john"/>
+ <xmpp:outbound-endpoint recipient="john" exchange-pattern="one-way"/>
</pass-through-router>
</outbound>
</service>
Please sign in to comment.
Something went wrong with that request. Please try again.