[color=red][b]helloworld_file_action 展示了如何利用 FileGateway 来 循环 监听 特定目录下 指定后缀的文件的处理过程[/b][/color]
这对一些以文件为接口方式的集成,特别有用
[b]1.helloworld_file_action EBS配置[/b]
<?xml version = "1.0" encoding = "UTF-8"?>
<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5" >
[color=red] <providers>
<fs-provider name="FSprovider1">
<fs-bus busid="helloFileChannel" >
<fs-message-filter
directory="C:\helloworld_file_action\build\dirs\input"
input-suffix=".dat"
work-suffix=".esbWorking"
post-delete="false"
post-directory="C:\helloworld_file_action\build\dirs\output"
post-suffix=".sentToEsb"
error-delete="false"
error-directory="C:\helloworld_file_action\build\dirs\error"
error-suffix=".IN_ERROR"
/>
</fs-bus>
</fs-provider>
<jms-provider name="JBossMessaging" connection-factory="ConnectionFactory" >
<jms-bus busid="quickstartEsbChannel">
<jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_helloworld_file_esb" selector="type='fromHelloworldFileAction'"/>
</jms-bus>
</jms-provider>
</providers>[/color]
<services>
<service category="myCategory" name="myFileListener" description="Hello World File Action (esb listener)" >
[color=blue] <listeners>
<fs-listener name="FileGateway" busidref="helloFileChannel" is-gateway="true" poll-frequency-seconds="10" />
<jms-listener name="helloWorldFileAction" busidref="quickstartEsbChannel"/>
</listeners>[/color]
[color=indigo] <actions mep="OneWay">
<action name="testAction" class="org.jboss.soa.esb.actions.SystemPrintln" />
<action name="action1" class="org.jboss.soa.esb.samples.quickstart.helloworldfileaction.MyAction" process="displayMessage,playWithMessage" />
<action name="dump" class="org.jboss.soa.esb.actions.SystemPrintln">
<property name="printfull" value="true"/>
</action>
<!-- The next action is for Continuous Integration testing -->
<action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore" />
</actions>[/color]
</service>
</services>
</jbossesb>
[b]2. Provider:[/b]
fs-provider 文件provider,主要用来在本地指定目录、指定后缀的文件,将文件的内容作为消息发送到 Service 的 esb bus(该例子是 quickstartEsbChannel )上去。
jms-provider 用来定义 Service 的 esb bus 的消息队列
[b]3. 配置了 FileGateway listener 和 bus listener 监听器 分别 监听 文件 和 消息队列[/b]
[b]4. 自定义Action只是打印文件的内容[/b]
这对一些以文件为接口方式的集成,特别有用
[b]1.helloworld_file_action EBS配置[/b]
<?xml version = "1.0" encoding = "UTF-8"?>
<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5" >
[color=red] <providers>
<fs-provider name="FSprovider1">
<fs-bus busid="helloFileChannel" >
<fs-message-filter
directory="C:\helloworld_file_action\build\dirs\input"
input-suffix=".dat"
work-suffix=".esbWorking"
post-delete="false"
post-directory="C:\helloworld_file_action\build\dirs\output"
post-suffix=".sentToEsb"
error-delete="false"
error-directory="C:\helloworld_file_action\build\dirs\error"
error-suffix=".IN_ERROR"
/>
</fs-bus>
</fs-provider>
<jms-provider name="JBossMessaging" connection-factory="ConnectionFactory" >
<jms-bus busid="quickstartEsbChannel">
<jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_helloworld_file_esb" selector="type='fromHelloworldFileAction'"/>
</jms-bus>
</jms-provider>
</providers>[/color]
<services>
<service category="myCategory" name="myFileListener" description="Hello World File Action (esb listener)" >
[color=blue] <listeners>
<fs-listener name="FileGateway" busidref="helloFileChannel" is-gateway="true" poll-frequency-seconds="10" />
<jms-listener name="helloWorldFileAction" busidref="quickstartEsbChannel"/>
</listeners>[/color]
[color=indigo] <actions mep="OneWay">
<action name="testAction" class="org.jboss.soa.esb.actions.SystemPrintln" />
<action name="action1" class="org.jboss.soa.esb.samples.quickstart.helloworldfileaction.MyAction" process="displayMessage,playWithMessage" />
<action name="dump" class="org.jboss.soa.esb.actions.SystemPrintln">
<property name="printfull" value="true"/>
</action>
<!-- The next action is for Continuous Integration testing -->
<action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore" />
</actions>[/color]
</service>
</services>
</jbossesb>
[b]2. Provider:[/b]
fs-provider 文件provider,主要用来在本地指定目录、指定后缀的文件,将文件的内容作为消息发送到 Service 的 esb bus(该例子是 quickstartEsbChannel )上去。
jms-provider 用来定义 Service 的 esb bus 的消息队列
[b]3. 配置了 FileGateway listener 和 bus listener 监听器 分别 监听 文件 和 消息队列[/b]
[b]4. 自定义Action只是打印文件的内容[/b]