LibraryLink ToToggle FramesPrintFeedback

Message Filter

A message filter is a processor that eliminates undesired messages based on specific criteria. Filtering is controlled by specifying a predicate in the filter: when the predicate is true, the incoming message is allowed to pass; otherwise, it is blocked. This pattern maps to the corresponding message filter pattern in FUSE Mediation Router.


The following example shows how to define a message filter using the ServiceMix EIP component. Incoming messages are passed through a filter mechanism that blocks messages that lack a test:world element.

<eip:message-filter service="test:messageFilter" endpoint="endpoint">
  <eip:target>
    <eip:exchange-target service="test:trace3" />
  </eip:target>
  <eip:filter>
    <eip:xpath-predicate xpath="count(/test:world) = 1" namespaceContext="#nsContext"/>
  </eip:filter>
</eip:message-filter>

The following example shows how to define an equivalent route using FUSE Mediation Router XML configuration:

<route>
  <from uri="jbi:endpoint:http://progress.com/demos/test/messageFilter/endpoint">
  <filter>
   <xpath>count(/test:world) = 1</xpath>
   <to uri="jbi:service:http://progress.com/demos/test/trace3"/>
  </filter>
</route>

The following example shows how to define an equivalent route using the FUSE Mediation Router Java DSL:

from("jbi:endpoint:http://progress.com/demos/test/messageFilter/endpoint").
  filter(xpath("count(/test:world) = 1")).
  to("jbi:service:http://progress.com/demos/test/trace3");