|
6 | 6 |
|
7 | 7 | /** |
8 | 8 | * |
9 | | - * When applications communicate with each other using a messaging system |
10 | | - * they first need to establish a communication channel that will carry the |
11 | | - * data. Message Channel decouples Message producers (publisher) and consumers (subscriber). |
| 9 | + * When applications communicate with each other using a messaging system they first need to |
| 10 | + * establish a communication channel that will carry the data. Message Channel decouples Message |
| 11 | + * producers (publisher) and consumers (subscriber). |
12 | 12 | * <p> |
13 | | - * The sending application doesn't necessarily know what particular applications |
14 | | - * will end up retrieving it, but it can be assured that the application that |
15 | | - * retrieves the information is interested in that information. This is because |
16 | | - * the messaging system has different Message Channels for different types of |
17 | | - * information the applications want to communicate. When an application sends |
18 | | - * information, it doesn't randomly add the information to any channel available; |
19 | | - * it adds it to a channel whose specific purpose is to communicate that sort of |
20 | | - * information. Likewise, an application that wants to receive particular information |
21 | | - * doesn't pull info off some random channel; it selects what channel to get information |
22 | | - * from based on what type of information it wants. |
| 13 | + * The sending application doesn't necessarily know what particular applications will end up |
| 14 | + * retrieving it, but it can be assured that the application that retrieves the information is |
| 15 | + * interested in that information. This is because the messaging system has different Message |
| 16 | + * Channels for different types of information the applications want to communicate. When an |
| 17 | + * application sends information, it doesn't randomly add the information to any channel available; |
| 18 | + * it adds it to a channel whose specific purpose is to communicate that sort of information. |
| 19 | + * Likewise, an application that wants to receive particular information doesn't pull info off some |
| 20 | + * random channel; it selects what channel to get information from based on what type of information |
| 21 | + * it wants. |
23 | 22 | * <p> |
24 | | - * In this example we use Apache Camel to establish different Message Channels. The first |
25 | | - * one reads from standard input and delivers messages to Direct endpoints (Publish; Broadcast). The other Message |
26 | | - * Channels are established from the Direct component to different Endpoints (Subscriber). No actual messages are sent, |
27 | | - * only the established routes are printed to standard output. |
| 23 | + * In this example we use Apache Camel to establish different Message Channels. The first one reads |
| 24 | + * from standard input and delivers messages to Direct endpoints (Publish; Broadcast). The other |
| 25 | + * Message Channels are established from the Direct component to different Endpoints (Subscriber). |
| 26 | + * No actual messages are sent, only the established routes are printed to standard output. |
28 | 27 | * |
29 | 28 | */ |
30 | 29 | public class App { |
31 | 30 |
|
32 | | - /** |
33 | | - * Program entry point |
34 | | - * |
35 | | - * @param args command line args |
36 | | - * @throws Exception |
37 | | - */ |
38 | | - public static void main(String[] args) throws Exception { |
39 | | - CamelContext context = new DefaultCamelContext(); |
40 | | - |
41 | | - context.addRoutes(new RouteBuilder() { |
| 31 | + /** |
| 32 | + * Program entry point |
| 33 | + * |
| 34 | + * @param args |
| 35 | + * command line args |
| 36 | + * @throws Exception |
| 37 | + */ |
| 38 | + public static void main(String[] args) throws Exception { |
| 39 | + CamelContext context = new DefaultCamelContext(); |
42 | 40 |
|
43 | | - @Override |
44 | | - public void configure() throws Exception { |
45 | | - from("stream:in") |
46 | | - .multicast() |
47 | | - .to("direct:greetings1", "direct:greetings2", "direct:greetings3"); |
48 | | - } |
49 | | - }); |
50 | | - |
51 | | - context.start(); |
52 | | - context.getRoutes().stream().forEach((r) -> System.out.println(r)); |
53 | | - context.stop(); |
54 | | - } |
| 41 | + context.addRoutes(new RouteBuilder() { |
| 42 | + |
| 43 | + @Override |
| 44 | + public void configure() throws Exception { |
| 45 | + from("stream:in").multicast().to("direct:greetings1", "direct:greetings2", |
| 46 | + "direct:greetings3"); |
| 47 | + } |
| 48 | + }); |
| 49 | + |
| 50 | + context.start(); |
| 51 | + context.getRoutes().stream().forEach((r) -> System.out.println(r)); |
| 52 | + context.stop(); |
| 53 | + } |
55 | 54 | } |
0 commit comments