Resolves checkstyle errors for eip-* (#1069)
* Reduces checkstyle errors in eip-aggregator * Reduces checkstyle errors in eip-message-channel * Reduces checkstyle errors in eip-publish-subscribe * Reduces checkstyle errors in eip-splitter * Reduces checkstyle errors in eip-wire-tap
This commit is contained in:
parent
f2c91eb836
commit
7c888e8886
@ -30,21 +30,20 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
import org.springframework.context.ConfigurableApplicationContext;
|
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
|
* Sometimes in enterprise systems there is a need to group incoming data in order to process it as
|
||||||
* you may need to gather offers and after defined number of offers has been received you would like to choose the one
|
* a whole. For example you may need to gather offers and after defined number of offers has been
|
||||||
* with the best parameters.
|
* 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>
|
|
||||||
*
|
*
|
||||||
|
* <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
|
@SpringBootApplication
|
||||||
public class App {
|
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
|
* @param args command line args
|
||||||
*/
|
*/
|
||||||
|
@ -30,16 +30,15 @@ import org.springframework.stereotype.Component;
|
|||||||
/**
|
/**
|
||||||
* Sample aggregator route definition.
|
* Sample aggregator route definition.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>It consumes messages out of the <i>direct:entry</i> entry point and forwards them to
|
||||||
* It consumes messages out of the <i>direct:entry</i> entry point and forwards them to <i>direct:endpoint</i>.
|
* <i>direct:endpoint</i>. Route accepts messages containing String as a body, it aggregates the
|
||||||
* Route accepts messages containing String as a body, it aggregates the messages based on the settings and forwards
|
* messages based on the settings and forwards them as CSV to the output chanel.
|
||||||
* them as CSV to the output chanel.
|
|
||||||
*
|
*
|
||||||
* Settings for the aggregation are: aggregate until 3 messages are bundled or wait 2000ms before sending bundled
|
* <p>Settings for the aggregation are: aggregate until 3 messages are bundled or wait 2000ms
|
||||||
* messages further.
|
* before sending bundled messages further.
|
||||||
* </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
|
@Component
|
||||||
public class AggregatorRoute extends RouteBuilder {
|
public class AggregatorRoute extends RouteBuilder {
|
||||||
@ -48,7 +47,8 @@ public class AggregatorRoute extends RouteBuilder {
|
|||||||
private MessageAggregationStrategy aggregator;
|
private MessageAggregationStrategy aggregator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the route
|
* Configures the route.
|
||||||
|
*
|
||||||
* @throws Exception in case of exception during configuration
|
* @throws Exception in case of exception during configuration
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,8 +28,8 @@ import org.apache.camel.processor.aggregate.AggregationStrategy;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aggregation strategy joining bodies of messages. If message is first one <i>oldMessage</i> is null. All changes are
|
* Aggregation strategy joining bodies of messages. If message is first one <i>oldMessage</i> is
|
||||||
* made on IN messages.
|
* null. All changes are made on IN messages.
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class MessageAggregationStrategy implements AggregationStrategy {
|
public class MessageAggregationStrategy implements AggregationStrategy {
|
||||||
|
@ -30,12 +30,11 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* When two applications communicate with each other using a messaging system they first need to
|
* 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
|
* establish a communication channel that will carry the data. Message Channel decouples Message
|
||||||
* producers and consumers.
|
* 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
|
* 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
|
* 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
|
* Channels for different types of information the applications want to communicate. When an
|
||||||
@ -44,19 +43,18 @@ import org.slf4j.LoggerFactory;
|
|||||||
* Likewise, an application that wants to receive particular information doesn't pull info off some
|
* 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
|
* random channel; it selects what channel to get information from based on what type of information
|
||||||
* it wants.
|
* it wants.
|
||||||
* <p>
|
*
|
||||||
* In this example we use Apache Camel to establish two different Message Channels. The first one
|
* <p>In this example we use Apache Camel to establish two different Message Channels. The first
|
||||||
* reads from standard input and delivers messages to Direct endpoint. The second Message Channel is
|
* one reads from standard input and delivers messages to Direct endpoint. The second Message
|
||||||
* established from the Direct component to console output. No actual messages are sent, only the
|
* Channel is established from the Direct component to console output. No actual messages are sent,
|
||||||
* established routes are printed to standard output.
|
* only the established routes are printed to standard output.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Program entry point
|
* Program entry point.
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
CamelContext context = new DefaultCamelContext();
|
CamelContext context = new DefaultCamelContext();
|
||||||
|
@ -31,30 +31,28 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* There are well-established patterns for implementing broadcasting. The Observer pattern describes
|
* 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 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
|
* 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
|
* observers there are (even none). The Publish-Subscribe pattern expands upon Observer by adding
|
||||||
* the notion of an event channel for communicating event notifications.
|
* 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
|
* <p>A Publish-Subscribe Channel works like this: It has one input channel that splits into
|
||||||
* output channels, one for each subscriber. When an event is published into the channel, the
|
* multiple output channels, one for each subscriber. When an event is published into the channel,
|
||||||
* Publish-Subscribe Channel delivers a copy of the message to each of the output channels. Each
|
* 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
|
* 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
|
* once. In this way, each subscriber gets the message only once, and consumed copies disappear from
|
||||||
* their channels.
|
* their channels.
|
||||||
* <p>
|
*
|
||||||
* In this example we use Apache Camel to establish a Publish-Subscribe Channel from "direct-origin"
|
* <p>In this example we use Apache Camel to establish a Publish-Subscribe Channel from
|
||||||
* to "mock:foo", "mock:bar" and "stream:out".
|
* "direct-origin" to "mock:foo", "mock:bar" and "stream:out".
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Program entry point
|
* Program entry point.
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
CamelContext context = new DefaultCamelContext();
|
CamelContext context = new DefaultCamelContext();
|
||||||
|
@ -30,23 +30,24 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It is very common in integration systems that incoming messages consists of many items bundled together. For example
|
* It is very common in integration systems that incoming messages consists of many items bundled
|
||||||
* an invoice document contains multiple invoice lines describing transaction (quantity, name of provided
|
* together. For example an invoice document contains multiple invoice lines describing transaction
|
||||||
* service/sold goods, price etc.). Such bundled messages may not be accepted by other systems. This is where splitter
|
* (quantity, name of provided service/sold goods, price etc.). Such bundled messages may not be
|
||||||
* pattern comes in handy. It will take the whole document, split it based on given criteria and send individual
|
* accepted by other systems. This is where splitter pattern comes in handy. It will take the whole
|
||||||
* items to the endpoint.
|
* document, split it based on given criteria and send individual items to the endpoint.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Splitter allows you to split messages based on defined criteria. It takes original message, process it and send
|
* Splitter allows you to split messages based on defined criteria. It takes original message,
|
||||||
* multiple parts to the output channel. It is not defined if it should keep the order of items though.
|
* process it and send multiple parts to the output channel. It is not defined if it should keep the
|
||||||
|
* order of items though.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class App {
|
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
|
* @param args command line args
|
||||||
*/
|
*/
|
||||||
|
@ -29,19 +29,19 @@ import org.springframework.stereotype.Component;
|
|||||||
/**
|
/**
|
||||||
* Sample splitter route definition.
|
* Sample splitter route definition.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>It consumes messages out of the <i>direct:entry</i> entry point and forwards them to
|
||||||
* It consumes messages out of the <i>direct:entry</i> entry point and forwards them to <i>direct:endpoint</i>.
|
* <i>direct:endpoint</i>. Route accepts messages having body of array or collection of objects.
|
||||||
* Route accepts messages having body of array or collection of objects. Splitter component split message body and
|
* Splitter component split message body and forwards single objects to the endpoint.
|
||||||
* forwards single objects to the endpoint.
|
|
||||||
* </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
|
@Component
|
||||||
public class SplitterRoute extends RouteBuilder {
|
public class SplitterRoute extends RouteBuilder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the route
|
* Configures the route.
|
||||||
|
*
|
||||||
* @throws Exception in case of exception during configuration
|
* @throws Exception in case of exception during configuration
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -30,21 +30,23 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
import org.springframework.context.ConfigurableApplicationContext;
|
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
|
* In most integration cases there is a need to monitor the messages flowing through the system. It
|
||||||
* by intercepting the message and redirecting it to a different location like console, filesystem or the database.
|
* is usually achieved by intercepting the message and redirecting it to a different location like
|
||||||
* It is important that such functionality should not modify the original message and influence the processing path.
|
* console, filesystem or the database. It is important that such functionality should not modify
|
||||||
|
* the original message and influence the processing path.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Wire Tap allows you to route messages to a separate location while they are being forwarded to the ultimate
|
* Wire Tap allows you to route messages to a separate location while they are being forwarded to
|
||||||
* destination. It basically consumes messages of the input channel and publishes the unmodified message to both
|
* the ultimate destination. It basically consumes messages of the input channel and publishes the
|
||||||
* output channels.
|
* unmodified message to both output channels.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class App {
|
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
|
* @param args command line args
|
||||||
*/
|
*/
|
||||||
|
@ -29,19 +29,20 @@ import org.springframework.stereotype.Component;
|
|||||||
/**
|
/**
|
||||||
* Sample wire tap route definition.
|
* Sample wire tap route definition.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>It consumes messages out of the <i>direct:entry</i> entry point and forwards them to
|
||||||
* It consumes messages out of the <i>direct:entry</i> entry point and forwards them to <i>direct:endpoint</i>.
|
* <i>direct:endpoint</i>. Wire Tap intercepts the message and sends it to <i>direct:wireTap</i>,
|
||||||
* Wire Tap intercepts the message and sends it to <i>direct:wireTap</i>, which in turn forwards it to
|
* which in turn forwards it to
|
||||||
* <i>direct:wireTapEndpoint</i>.
|
* <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
|
@Component
|
||||||
public class WireTapRoute extends RouteBuilder {
|
public class WireTapRoute extends RouteBuilder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the route
|
* Configures the route.
|
||||||
|
*
|
||||||
* @throws Exception in case of exception during configuration
|
* @throws Exception in case of exception during configuration
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user