FuseByExample - Camel Example Tcpip Proxy GitHub
FuseByExample - Camel Example Tcpip Proxy GitHub
FuseByExample - Camel Example Tcpip Proxy GitHub
FuseByExample/camel-example-tcpip-proxy GitHub
This repository
Explore
Search
Features
Enterprise
Blog
Sign up
FuseByExample / camel-example-tcpip-proxy
Star
Sign in
Fork
Fuse ESB (ServiceMix) example of Apache Camel acting as an TCP/IP Proxy with failover capability
Code
15 commits
2 branches
branch: master
0 releases
6 contributors
camel-example-tcpip-proxy /
Issues
Pull Requests
latestcommitd0dcfdcd66
client
2 years ago
controller
Fixed the controller module test case to not append line-feed ("\n")
2 years ago
images
2 years ago
router
2 years ago
.gitignore
2 years ago
README.md
pom.xml
Pulse
Graphs
https://github.com/Fuse
ByExample/camel
a year ago
7 months ago
Clone in Desktop
Download ZIP
README.md
Client sends TCP/IP messages to ESB acting as a proxy. A failover-capable router pickups up
messages and sends them to Controller 1 using a TCP/IP service call. Controller 1 stamps the
message as having been processed and returns it to the router, and then back to the Client
application.
If Controller 1 fails, the router fails over to Controller 2. For purposes of a fast prototype, Controller 1
and Controller 2 were run as simple Camel-Mina services run from the command line (external to the
ESB) so they were easy to kill to demonstrate failover. In practice, additional Fuse ESB containers
would be ideal to host controller services.
Software Requirements:
JBoss Fuse 6.1.0
Maven 3.x -- http://maven.apache.org
JDK 1.6 or 1.7
https://github.com/FuseByExample/camel-example-tcpip-proxy
1/4
1/3/2015
FuseByExample/camel-example-tcpip-proxy GitHub
Installing Fuse
Download and Install JBoss Fuse
Download JBoss Fuse at http://www.redhat.com/jbossfuse/download
Unzip the archive in a directory without spaces in its path.
Project Layout
There are three modules: applications, controllers and router. Here is the layout in the file system:
JBoss Fuse - RouterDemo
client
controller
router
You should see output like this, with a Bundle ID generated by the deployment:
JBossFuse:karaf@root>osgi:installsmvn:com.fusesource.demo/proxyrouter/1.0.0SNAPSHOT
BundleID:225
JBossFuse:karaf@root>
https://github.com/FuseByExample/camel-example-tcpip-proxy
2/4
1/3/2015
FuseByExample/camel-example-tcpip-proxy GitHub
Launch Client
Open a new terminal sessions and switch to the root of the applications project. In the session,
execute this command to launch the test Client application:
client$mvncamel:run
You should see the Client sending and receiving messages like below. Notice the response has a
element, that initially contains 'Controller 1'
17:44:47INFOApacheCamel2.10.0.redhat60024(CamelContext:camel1)startedin0.573seconds
17:44:47INFOSendingmessage1withdata:<data><messageNumber>1</messageNumber><timestamp>17:44:47.348</timestamp></data>
17:44:47INFOReceived1message:<data><messageNumber>1</messageNumber><timestamp>17:44:47.348</timestamp><controller>Controller1</co
17:44:48INFOSendingmessage2withdata:<data><messageNumber>2</messageNumber><timestamp>17:44:48.335</timestamp></data>
17:44:48INFOReceived2message:<data><messageNumber>2</messageNumber><timestamp>17:44:48.335</timestamp><controller>Controller1</co
17:44:49INFOSendingmessage3withdata:<data><messageNumber>3</messageNumber><timestamp>17:44:49.335</timestamp></data>
17:44:49INFOReceived3message:<data><messageNumber>3</messageNumber><timestamp>17:44:49.335</timestamp><controller>Controller1</co
17:44:50INFOSendingmessage4withdata:<data><messageNumber>4</messageNumber><timestamp>17:44:50.334</timestamp></data>
17:44:50INFOReceived4message:<data><messageNumber>4</messageNumber><timestamp>17:44:50.334</timestamp><controller>Controller1</co
17:44:51INFOSendingmessage5withdata:<data><messageNumber>5</messageNumber><timestamp>17:44:51.334</timestamp></data>
17:44:51INFOReceived5message:<data><messageNumber>5</messageNumber><timestamp>17:44:51.334</timestamp><controller>Controller1</co
17:44:52INFOSendingmessage6withdata:<data><messageNumber>6</messageNumber><timestamp>17:44:52.334</timestamp></data>
17:44:52INFOReceived6message:<data><messageNumber>6</messageNumber><timestamp>17:44:52.334</timestamp><controller>Controller1</co
Kill the Controller 1 session any way you like, and you should see uninterrupted message flow, with
Controller 2 handling the messages (note the changes to 'Controller 2' at message 12):
17:44:56INFOSendingmessage10withdata:<data><messageNumber>10</messageNumber><timestamp>17:44:56.334</timestamp></data>
17:44:56INFOReceived10message:<data><messageNumber>10</messageNumber><timestamp>17:44:56.334</timestamp><controller>Controller1</
17:44:57INFOSendingmessage11withdata:<data><messageNumber>11</messageNumber><timestamp>17:44:57.335</timestamp></data>
17:44:57INFOReceived11message:<data><messageNumber>11</messageNumber><timestamp>17:44:57.335</timestamp><controller>Controller1</
17:44:58INFOSendingmessage12withdata:<data><messageNumber>12</messageNumber><timestamp>17:44:58.334</timestamp></data>
17:44:58INFOReceived12message:<data><messageNumber>12</messageNumber><timestamp>17:44:58.334</timestamp><controller>Controller2</
17:44:59INFOSendingmessage13withdata:<data><messageNumber>13</messageNumber><timestamp>17:44:59.334</timestamp></data>
17:44:59INFOReceived13message:<data><messageNumber>13</messageNumber><timestamp>17:44:59.334</timestamp><controller>Controller2</
Restart Controller 1 and youll see it take control back from Controller 2 (this is user-defined behavior
in the configuration of the failover-load balancer)
:<data><messageNumber>40</messageNumber><timestamp>17:45:26.333</timestamp></data>
messageNumber>40</messageNumber><timestamp>17:45:26.333</timestamp><controller>Controller2</controller></data>
:<data><messageNumber>41</messageNumber><timestamp>17:45:27.334</timestamp></data>
messageNumber>41</messageNumber><timestamp>17:45:27.334</timestamp><controller>Controller2</controller></data>
:<data><messageNumber>42</messageNumber><timestamp>17:45:28.335</timestamp></data>
messageNumber>42</messageNumber><timestamp>17:45:28.335</timestamp><controller>Controller1</controller></data>
:<data><messageNumber>43</messageNumber><timestamp>17:45:29.335</timestamp></data>
messageNumber>43</messageNumber><timestamp>17:45:29.335</timestamp><controller>Controller1</controller></data>
:<data><messageNumber>44</messageNumber><timestamp>17:45:30.335</timestamp></data>
messageNumber>44</messageNumber><timestamp>17:45:30.335</timestamp><controller>Controller1</controller></data>
https://github.com/FuseByExample/camel-example-tcpip-proxy
3/4
1/3/2015
FuseByExample/camel-example-tcpip-proxy GitHub
Terms
Privacy
Security
Contact
https://github.com/FuseByExample/camel-example-tcpip-proxy
Status
API
Training
Shop
Blog
About
4/4