Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.이 콘텐츠는 선택한 언어로 제공되지 않습니다.
A.4. Content-based Router
Overview 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
A content-based router enables you to route messages to the appropriate destination, where the routing decision is based on the message contents. This pattern maps to the corresponding content-based router pattern in Apache Camel.
Figure A.1. Content-based Router Pattern
Example ServiceMix EIP route 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Example A.1, “ServiceMix EIP Content-based Route” shows how to define a content-based router using the ServicMix EIP component. If a
test:echo
element is present in the message body, the message is routed to the http://test/pipeline/endpoint
endpoint. Otherwise, the message is routed to the test:recipients
endpoint.
Example A.1. ServiceMix EIP Content-based Route
Equivalent Apache Camel XML route 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Example A.2, “Apache Camel Content-based Router Using XML Configuration” shows how to define an equivalent route using Apache Camel XML configuration.
Example A.2. Apache Camel Content-based Router Using XML Configuration
Equivalent Apache Camel Java DSL route 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Example A.3, “Apache Camel Content-based Router Using Java DSL” shows how to define an equivalent route using the Apache Camel Java DSL.
Example A.3. Apache Camel Content-based Router Using Java DSL
from("jbi:endpoint:http://progress.com/demos/test/router/endpoint"). choice().when(xpath("count(/test:echo) = 1")).to("jbi:endpoint:http://progress.com/demos/test/pipeline/endpoint"). otherwise().to("jbi:service:http://progress.com/demos/test/recipients");
from("jbi:endpoint:http://progress.com/demos/test/router/endpoint").
choice().when(xpath("count(/test:echo) = 1")).to("jbi:endpoint:http://progress.com/demos/test/pipeline/endpoint").
otherwise().to("jbi:service:http://progress.com/demos/test/recipients");