blob: 238d13401e5967c0589242577706fd65c616a2f2 [file] [log] [blame]
== Camel Example Netty Custom Correlation
This example shows how to use TCP communication with Netty using a custom codec
to encode and decode the data over the wire.
The example also uses a single shared connection between the client and the server
to multiplex concurrent messages over the same connection. A custom correlation manager
is implemented to be able to correlate the request and response message pairs so you
do not mix-data to wrong replies.
=== Build
You will need to compile this example first:
[source,sh]
----
$ mvn compile
----
=== How to run
You can run this example using two JVMs.
To start the server run:
----
$ mvn exec:java -P server
----
To start the client run:
----
$ mvn exec:java -P client
----
In the client output you should see it logs request/response pairs.
For requests that contains the word `beer` is delayed on the server side, and you
should notice that its corresponding reply is correlated correctly to its belonging request thread.
Also, the messages can be inter-leaved when some messages are faster than others.
=== Help and contributions
If you hit any problem using Camel or have some feedback, then please
https://camel.apache.org/community/support/[let us know].
We also love contributors, so
https://camel.apache.org/community/contributing/[get involved] :-)
The Camel riders!