Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,20 @@
import org.springframework.context.ConfigurableApplicationContext;

/**
* Sometimes in enterprise systems there is a need to group incoming data in order to process it as a whole. For example
* you may need to gather offers and after defined number of offers has been received you would like to choose the one
* with the best parameters.
*
* <p>
* Aggregator allows you to merge messages based on defined criteria and parameters. It gathers original messages,
* applies aggregation strategy and upon fulfilling given criteria, releasing merged messages.
* </p>
* Sometimes in enterprise systems there is a need to group incoming data in order to process it as
* a whole. For example you may need to gather offers and after defined number of offers has been
* received you would like to choose the one with the best parameters.
*
* <p>Aggregator allows you to merge messages based on defined criteria and parameters. It gathers
* original messages, applies aggregation strategy and upon fulfilling given criteria, releasing
* merged messages.
*/
@SpringBootApplication
public class App {

/**
* Program entry point. It starts Spring Boot application and using Apache Camel it auto-configures routes.
* Program entry point. It starts Spring Boot application and using Apache Camel it
* auto-configures routes.
*
* @param args command line args
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@
/**
* Sample aggregator route definition.
*
* <p>
* It consumes messages out of the <i>direct:entry</i> entry point and forwards them to <i>direct:endpoint</i>.
* Route accepts messages containing String as a body, it aggregates the messages based on the settings and forwards
* them as CSV to the output chanel.
* <p>It consumes messages out of the <i>direct:entry</i> entry point and forwards them to
* <i>direct:endpoint</i>. Route accepts messages containing String as a body, it aggregates the
* messages based on the settings and forwards them as CSV to the output chanel.
*
* Settings for the aggregation are: aggregate until 3 messages are bundled or wait 2000ms before sending bundled
* messages further.
* </p>
* <p>Settings for the aggregation are: aggregate until 3 messages are bundled or wait 2000ms
* before sending bundled messages further.
*
* In this example input/output endpoints names are stored in <i>application.properties</i> file.
* <p>In this example input/output endpoints names are stored in <i>application.properties</i>
* file.
*/
@Component
public class AggregatorRoute extends RouteBuilder {
Expand All @@ -48,7 +47,8 @@ public class AggregatorRoute extends RouteBuilder {
private MessageAggregationStrategy aggregator;

/**
* Configures the route
* Configures the route.
*
* @throws Exception in case of exception during configuration
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.springframework.stereotype.Component;

/**
* Aggregation strategy joining bodies of messages. If message is first one <i>oldMessage</i> is null. All changes are
* made on IN messages.
* Aggregation strategy joining bodies of messages. If message is first one <i>oldMessage</i> is
* null. All changes are made on IN messages.
*/
@Component
public class MessageAggregationStrategy implements AggregationStrategy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@
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
*
* <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
Expand All @@ -44,19 +43,18 @@
* 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.
*
*
* <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
* Program entry point.
*/
public static void main(String[] args) throws Exception {
CamelContext context = new DefaultCamelContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,28 @@
import org.slf4j.LoggerFactory;

/**
*
* There are well-established patterns for implementing broadcasting. The Observer pattern describes
* the need to decouple observers from their subject (that is, the originator of the event) so that
* the subject can easily provide event notification to all interested observers no matter how many
* observers there are (even none). The Publish-Subscribe pattern expands upon Observer by adding
* the notion of an event channel for communicating event notifications.
* <p>
* A Publish-Subscribe Channel works like this: It has one input channel that splits into multiple
* output channels, one for each subscriber. When an event is published into the channel, the
* Publish-Subscribe Channel delivers a copy of the message to each of the output channels. Each
*
* <p>A Publish-Subscribe Channel works like this: It has one input channel that splits into
* multiple output channels, one for each subscriber. When an event is published into the channel,
* the Publish-Subscribe Channel delivers a copy of the message to each of the output channels. Each
* output end of the channel has only one subscriber, which is allowed to consume a message only
* once. In this way, each subscriber gets the message only once, and consumed copies disappear from
* their channels.
* <p>
* In this example we use Apache Camel to establish a Publish-Subscribe Channel from "direct-origin"
* to "mock:foo", "mock:bar" and "stream:out".
*
*
* <p>In this example we use Apache Camel to establish a Publish-Subscribe Channel from
* "direct-origin" to "mock:foo", "mock:bar" and "stream:out".
*/
public class App {

private static final Logger LOGGER = LoggerFactory.getLogger(App.class);

/**
* Program entry point
* Program entry point.
*/
public static void main(String[] args) throws Exception {
CamelContext context = new DefaultCamelContext();
Expand Down
19 changes: 10 additions & 9 deletions eip-splitter/src/main/java/com/iluwatar/eip/splitter/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,24 @@
import org.springframework.context.ConfigurableApplicationContext;

/**
* It is very common in integration systems that incoming messages consists of many items bundled together. For example
* an invoice document contains multiple invoice lines describing transaction (quantity, name of provided
* service/sold goods, price etc.). Such bundled messages may not be accepted by other systems. This is where splitter
* pattern comes in handy. It will take the whole document, split it based on given criteria and send individual
* items to the endpoint.
* It is very common in integration systems that incoming messages consists of many items bundled
* together. For example an invoice document contains multiple invoice lines describing transaction
* (quantity, name of provided service/sold goods, price etc.). Such bundled messages may not be
* accepted by other systems. This is where splitter pattern comes in handy. It will take the whole
* document, split it based on given criteria and send individual items to the endpoint.
*
* <p>
* Splitter allows you to split messages based on defined criteria. It takes original message, process it and send
* multiple parts to the output channel. It is not defined if it should keep the order of items though.
* Splitter allows you to split messages based on defined criteria. It takes original message,
* process it and send multiple parts to the output channel. It is not defined if it should keep the
* order of items though.
* </p>
*
*/
@SpringBootApplication
public class App {

/**
* Program entry point. It starts Spring Boot application and using Apache Camel it auto-configures routes.
* Program entry point. It starts Spring Boot application and using Apache Camel it
* auto-configures routes.
*
* @param args command line args
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
/**
* Sample splitter route definition.
*
* <p>
* It consumes messages out of the <i>direct:entry</i> entry point and forwards them to <i>direct:endpoint</i>.
* Route accepts messages having body of array or collection of objects. Splitter component split message body and
* forwards single objects to the endpoint.
* </p>
* <p>It consumes messages out of the <i>direct:entry</i> entry point and forwards them to
* <i>direct:endpoint</i>. Route accepts messages having body of array or collection of objects.
* Splitter component split message body and forwards single objects to the endpoint.
*
* In this example input/output endpoints names are stored in <i>application.properties</i> file.
* <p>In this example input/output endpoints names are stored in <i>application.properties</i>
* file.
*/
@Component
public class SplitterRoute extends RouteBuilder {

/**
* Configures the route
* Configures the route.
*
* @throws Exception in case of exception during configuration
*/
@Override
Expand Down
16 changes: 9 additions & 7 deletions eip-wire-tap/src/main/java/com/iluwatar/eip/wiretap/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,23 @@
import org.springframework.context.ConfigurableApplicationContext;

/**
* In most integration cases there is a need to monitor the messages flowing through the system. It is usually achieved
* by intercepting the message and redirecting it to a different location like console, filesystem or the database.
* It is important that such functionality should not modify the original message and influence the processing path.
* In most integration cases there is a need to monitor the messages flowing through the system. It
* is usually achieved by intercepting the message and redirecting it to a different location like
* console, filesystem or the database. It is important that such functionality should not modify
* the original message and influence the processing path.
*
* <p>
* Wire Tap allows you to route messages to a separate location while they are being forwarded to the ultimate
* destination. It basically consumes messages of the input channel and publishes the unmodified message to both
* output channels.
* Wire Tap allows you to route messages to a separate location while they are being forwarded to
* the ultimate destination. It basically consumes messages of the input channel and publishes the
* unmodified message to both output channels.
* </p>
*/
@SpringBootApplication
public class App {

/**
* Program entry point. It starts Spring Boot application and using Apache Camel it auto-configures routes.
* Program entry point. It starts Spring Boot application and using Apache Camel it
* auto-configures routes.
*
* @param args command line args
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,20 @@
/**
* Sample wire tap route definition.
*
* <p>
* It consumes messages out of the <i>direct:entry</i> entry point and forwards them to <i>direct:endpoint</i>.
* Wire Tap intercepts the message and sends it to <i>direct:wireTap</i>, which in turn forwards it to
* <p>It consumes messages out of the <i>direct:entry</i> entry point and forwards them to
* <i>direct:endpoint</i>. Wire Tap intercepts the message and sends it to <i>direct:wireTap</i>,
* which in turn forwards it to
* <i>direct:wireTapEndpoint</i>.
* </p>
*
* In this example input/output endpoints names are stored in <i>application.properties</i> file.
* <p>In this example input/output endpoints names are stored in <i>application.properties</i>
* file.
*/
@Component
public class WireTapRoute extends RouteBuilder {

/**
* Configures the route
* Configures the route.
*
* @throws Exception in case of exception during configuration
*/
@Override
Expand Down