concept endpoint in category akka

This is an excerpt from Manning's book Akka in Action.
For example, say you’re creating an order system for use in a book stockroom; our system processes orders from all kinds of customers. These customers can order the books by visiting the store. The bookstore already uses an application to sell and order books, so the new system needs to exchange data with this existing application. This can only be done if both systems agree on which messages are sent and how they’re sent. Because you probably can’t change the external application, you have to create a component that can send and/or receive messages from the existing application. This component is called an endpoint. Endpoints are part of our system, and are the glue between the external system and the rest of our system, which is shown in figure 12.1.
The endpoint has the responsibility of encapsulating the interface between the two systems in such a way that the application itself doesn’t need to know how the request is received. This is done by making the transport pluggable, using a canonical data format, and standardizing on a request/response style of communication. There are a lot of different transport protocols to potentially support: HTTP, TCP, message queues, or simple files. After receiving the message, the endpoint has to translate the message into a message format that’s supported by our order system. Translating the message this way means the rest of the system doesn’t know that the order was received from an external system. In this example the endpoint receives a request from the external system and sends a response back. This is called a consumer endpoint because it consumes the request. It’s also possible that our system needs some data from another system, for example, the customer details, which are kept in the customer relations application.
In figure 12.2 the order system initiates the communication between systems, and because the endpoint produces a message that’s sent to the external system, this is called a producer endpoint. Both usages of the endpoints hide the details of the communication from the rest of the system, and when the interface between the two systems changes, only the endpoint needs to be changed. There are a few patterns in the EIP catalog that apply for such endpoints. The first pattern we’ll describe is the normalizer pattern.
Using akka-camel is easy. Just add akka-camel to the project dependencies, and you can use the Camel Consumer and/or Producer classes to create an endpoint. Using these classes will hide the implementation of the transport layer. The only functionality you have to implement is the translations between your system messages and the interface messages.