Consistent naming for EIP patterns #733
This commit is contained in:
1
eip-message-channel/.gitignore
vendored
Normal file
1
eip-message-channel/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target/
|
26
eip-message-channel/README.md
Normal file
26
eip-message-channel/README.md
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
layout: pattern
|
||||
title: EIP Message Channel
|
||||
folder: eip-message-channel
|
||||
permalink: /patterns/eip-message-channel/
|
||||
categories: Integration
|
||||
tags:
|
||||
- Java
|
||||
- EIP
|
||||
- Apache Camel™
|
||||
---
|
||||
|
||||
## Intent
|
||||
When two applications communicate using a messaging system they do it by using logical addresses
|
||||
of the system, so called Message Channels.
|
||||
|
||||

|
||||
|
||||
## Applicability
|
||||
Use the Message Channel pattern when
|
||||
|
||||
* two or more applications need to communicate using a messaging system
|
||||
|
||||
## Real world examples
|
||||
|
||||
* [akka-camel](http://doc.akka.io/docs/akka/snapshot/scala/camel.html)
|
BIN
eip-message-channel/etc/message-channel.png
Normal file
BIN
eip-message-channel/etc/message-channel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
320
eip-message-channel/etc/message-channel.ucls
Normal file
320
eip-message-channel/etc/message-channel.ucls
Normal file
@ -0,0 +1,320 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<class-diagram version="1.1.8" icons="true" automaticImage="PNG" always-add-relationships="false" generalizations="true"
|
||||
realizations="true" associations="true" dependencies="false" nesting-relationships="true">
|
||||
<class id="1" language="java" name="org.apache.camel.builder.RouteBuilder" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="920" y="458"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<interface id="2" language="java" name="org.apache.camel.CamelContext" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="674" y="458"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<class id="3" language="java" name="org.apache.camel.model.RouteDefinition" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="673" y="48"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<class id="4" language="java" name="org.apache.camel.model.ProcessorDefinition" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="673" y="-96"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<class id="5" language="java" name="org.apache.camel.model.OptionalIdentifiedDefinition" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="248" y="-96"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<interface id="6" language="java" name="org.apache.camel.NamedNode" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="249" y="0"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<interface id="7" language="java" name="org.apache.camel.model.Block" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="464" y="13"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<interface id="8" language="java" name="org.apache.camel.RoutesBuilder" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="920" y="590"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<class id="9" language="java" name="org.apache.camel.builder.BuilderSupport" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="920" y="297"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<interface id="10" language="java" name="org.apache.camel.SuspendableService" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="267" y="458"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<interface id="11" language="java" name="org.apache.camel.Service" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="267" y="297"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<interface id="12" language="java" name="org.apache.camel.RuntimeConfiguration" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="674" y="590"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<class id="13" language="java" name="org.apache.camel.impl.DefaultCamelContext" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="673" y="167"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<class id="14" language="java" name="org.apache.camel.support.ServiceSupport" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="265" y="91"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</class>
|
||||
<interface id="15" language="java" name="org.apache.camel.StatefulService" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="5" y="188"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<interface id="16" language="java" name="org.apache.camel.ShutdownableService" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="265" y="188"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<interface id="17" language="java" name="org.apache.camel.model.ModelCamelContext" project="message-channel"
|
||||
file="C:/Users/ilkka/.m2/repository/org/apache/camel/camel-core/2.15.3/camel-core-2.15.3.jar" binary="true"
|
||||
corner="BOTTOM_RIGHT">
|
||||
<position height="-1" width="-1" x="674" y="297"/>
|
||||
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</display>
|
||||
</interface>
|
||||
<generalization id="18">
|
||||
<end type="SOURCE" refId="4"/>
|
||||
<end type="TARGET" refId="5"/>
|
||||
</generalization>
|
||||
<generalization id="19">
|
||||
<end type="SOURCE" refId="2"/>
|
||||
<end type="TARGET" refId="10"/>
|
||||
</generalization>
|
||||
<realization id="20">
|
||||
<end type="SOURCE" refId="1"/>
|
||||
<end type="TARGET" refId="8"/>
|
||||
</realization>
|
||||
<association id="21">
|
||||
<end type="SOURCE" refId="9" navigable="false">
|
||||
<attribute id="22" name="context">
|
||||
<position height="0" width="0" x="-583" y="-276"/>
|
||||
</attribute>
|
||||
<multiplicity id="23" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="-583" y="-276"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="17" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="24">
|
||||
<end type="SOURCE" refId="4" navigable="false">
|
||||
<attribute id="25" name="blocks">
|
||||
<position height="0" width="0" x="145" y="-462"/>
|
||||
</attribute>
|
||||
<multiplicity id="26" minimum="0" maximum="2147483647">
|
||||
<position height="0" width="0" x="145" y="-462"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="7" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="27">
|
||||
<end type="SOURCE" refId="13" navigable="false">
|
||||
<attribute id="28" name="servicesToClose">
|
||||
<position height="0" width="0" x="-409" y="37"/>
|
||||
</attribute>
|
||||
<multiplicity id="29" minimum="0" maximum="2147483647">
|
||||
<position height="0" width="0" x="-409" y="37"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="11" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<realization id="30">
|
||||
<end type="SOURCE" refId="13"/>
|
||||
<end type="TARGET" refId="17"/>
|
||||
</realization>
|
||||
<realization id="31">
|
||||
<end type="SOURCE" refId="14"/>
|
||||
<end type="TARGET" refId="15"/>
|
||||
</realization>
|
||||
<generalization id="32">
|
||||
<end type="SOURCE" refId="17"/>
|
||||
<end type="TARGET" refId="2"/>
|
||||
</generalization>
|
||||
<generalization id="33">
|
||||
<end type="SOURCE" refId="15"/>
|
||||
<end type="TARGET" refId="10"/>
|
||||
</generalization>
|
||||
<generalization id="34">
|
||||
<end type="SOURCE" refId="1"/>
|
||||
<end type="TARGET" refId="9"/>
|
||||
</generalization>
|
||||
<generalization id="35">
|
||||
<end type="SOURCE" refId="3"/>
|
||||
<end type="TARGET" refId="4"/>
|
||||
</generalization>
|
||||
<generalization id="36">
|
||||
<end type="SOURCE" refId="16"/>
|
||||
<end type="TARGET" refId="11"/>
|
||||
</generalization>
|
||||
<generalization id="37">
|
||||
<end type="SOURCE" refId="15"/>
|
||||
<end type="TARGET" refId="16"/>
|
||||
</generalization>
|
||||
<generalization id="38">
|
||||
<end type="SOURCE" refId="10"/>
|
||||
<end type="TARGET" refId="11"/>
|
||||
</generalization>
|
||||
<realization id="39">
|
||||
<end type="SOURCE" refId="4"/>
|
||||
<end type="TARGET" refId="7"/>
|
||||
</realization>
|
||||
<association id="40">
|
||||
<end type="SOURCE" refId="4" navigable="false">
|
||||
<attribute id="41" name="parent">
|
||||
<position height="0" width="0" x="329" y="-461"/>
|
||||
</attribute>
|
||||
<multiplicity id="42" minimum="0" maximum="1">
|
||||
<position height="0" width="0" x="329" y="-461"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="4" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<realization id="43">
|
||||
<end type="SOURCE" refId="5"/>
|
||||
<end type="TARGET" refId="6"/>
|
||||
</realization>
|
||||
<generalization id="44">
|
||||
<end type="SOURCE" refId="2"/>
|
||||
<end type="TARGET" refId="12"/>
|
||||
</generalization>
|
||||
<generalization id="45">
|
||||
<end type="SOURCE" refId="13"/>
|
||||
<end type="TARGET" refId="14"/>
|
||||
</generalization>
|
||||
<association id="46">
|
||||
<end type="SOURCE" refId="3" navigable="false">
|
||||
<attribute id="47" name="outputs">
|
||||
<position height="0" width="0" x="329" y="-461"/>
|
||||
</attribute>
|
||||
<multiplicity id="48" minimum="0" maximum="2147483647">
|
||||
<position height="0" width="0" x="329" y="-461"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="4" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<association id="49">
|
||||
<end type="SOURCE" refId="13" navigable="false">
|
||||
<attribute id="50" name="routeDefinitions">
|
||||
<position height="0" width="0" x="291" y="-218"/>
|
||||
</attribute>
|
||||
<multiplicity id="51" minimum="0" maximum="2147483647">
|
||||
<position height="0" width="0" x="291" y="-218"/>
|
||||
</multiplicity>
|
||||
</end>
|
||||
<end type="TARGET" refId="3" navigable="true"/>
|
||||
<display labels="true" multiplicity="true"/>
|
||||
</association>
|
||||
<realization id="52">
|
||||
<end type="SOURCE" refId="13"/>
|
||||
<end type="TARGET" refId="10"/>
|
||||
</realization>
|
||||
<classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||
sort-features="false" accessors="true" visibility="true">
|
||||
<attributes public="false" package="false" protected="false" private="false" static="true"/>
|
||||
<operations public="false" package="false" protected="false" private="false" static="true"/>
|
||||
</classifier-display>
|
||||
<association-display labels="true" multiplicity="true"/>
|
||||
</class-diagram>
|
56
eip-message-channel/pom.xml
Normal file
56
eip-message-channel/pom.xml
Normal file
@ -0,0 +1,56 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
|
||||
The MIT License
|
||||
Copyright (c) 2014-2016 Ilkka Seppälä
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
-->
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.20.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>eip-message-channel</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-stream</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2014-2016 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
package com.iluwatar.eip.message.channel;
|
||||
|
||||
import org.apache.camel.CamelContext;
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.apache.camel.impl.DefaultCamelContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* When two applications communicate with each other using a messaging system they first need to
|
||||
* establish a communication channel that will carry the data. Message Channel decouples Message
|
||||
* producers and consumers.
|
||||
* <p>
|
||||
* The sending application doesn't necessarily know what particular application will end up
|
||||
* retrieving it, but it can be assured that the application that retrieves the information is
|
||||
* interested in that information. This is because the messaging system has different Message
|
||||
* Channels for different types of information the applications want to communicate. When an
|
||||
* application sends information, it doesn't randomly add the information to any channel available;
|
||||
* it adds it to a channel whose specific purpose is to communicate that sort of information.
|
||||
* Likewise, an application that wants to receive particular information doesn't pull info off some
|
||||
* random channel; it selects what channel to get information from based on what type of information
|
||||
* it wants.
|
||||
* <p>
|
||||
* In this example we use Apache Camel to establish two different Message Channels. The first one
|
||||
* reads from standard input and delivers messages to Direct endpoint. The second Message Channel is
|
||||
* established from the Direct component to console output. No actual messages are sent, only the
|
||||
* established routes are printed to standard output.
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
CamelContext context = new DefaultCamelContext();
|
||||
|
||||
context.addRoutes(new RouteBuilder() {
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
from("stream:in").to("direct:greetings");
|
||||
from("direct:greetings").to("stream:out");
|
||||
}
|
||||
});
|
||||
|
||||
context.start();
|
||||
context.getRoutes().stream().forEach(r -> LOGGER.info(r.toString()));
|
||||
context.stop();
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2014-2016 Ilkka Seppälä
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
package com.iluwatar.eip.message.channel;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* Application test
|
||||
*
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
String[] args = {};
|
||||
App.main(args);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user