Files
spring-integration-samples/basic/tcp-with-headers
Artem Bilan 361866da58 Move main to version 6.0
* Upgrade to the latest dependencies
* Migrate samples to `jakarta` namespace
* Rework `cafe-scripted` to RSocket instead of already removed RMI
* Migrate JMS samples to Apache Artemis for Jakarta EE 9
* Disables mails tests since there is a requirement to migrate to Greenmail for Jakarta EE 9 support
* Rework `generatePom` task to a new `maven-publish` plugin style
2022-01-20 17:10:31 -05:00
..
2019-03-25 12:49:27 -04:00
2019-03-25 12:49:27 -04:00
2022-01-20 17:10:31 -05:00

= TCP With Headers

There is no standard way to convey message headers over raw TCP; they need to be encoded into the payload on the sending side and decoded on the receiving side.

This example demonstrates how to use standard framework components to encode the payload and certain headers using JSON.
It takes console input and, if the input starts with a lower case, uppercases it and vice versa.
Whether to upper case or lower case the input is conveyed in a header 'type'.

Run from your favorite IDE, or from the command line `./gradlew :tcp-with-headers:run`.

Here is an example run...

```
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.3.RELEASE)

Enter some text; if it starts with a lower case character,
it will be uppercased by the server; otherwise it will be lowercased;
enter 'quit' to end
this should be uppercased
10:54:39.259 [pool-1-thread-2] INFO  exampleLogger - Received type header:upper
THIS SHOULD BE UPPERCASED
This should be lowercased
10:54:49.266 [pool-1-thread-2] INFO  exampleLogger - Received type header:lower
this should be lowercased
quit
```