Apply Google coding conventions
This commit is contained in:
parent
230c02fb24
commit
7885380633
@ -6,50 +6,49 @@ import org.apache.camel.impl.DefaultCamelContext;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* When applications communicate with each other using a messaging system
|
* When applications communicate with each other using a messaging system they first need to
|
||||||
* they first need to establish a communication channel that will carry the
|
* establish a communication channel that will carry the data. Message Channel decouples Message
|
||||||
* data. Message Channel decouples Message producers (publisher) and consumers (subscriber).
|
* producers (publisher) and consumers (subscriber).
|
||||||
* <p>
|
* <p>
|
||||||
* The sending application doesn't necessarily know what particular applications
|
* The sending application doesn't necessarily know what particular applications will end up
|
||||||
* will end up retrieving it, but it can be assured that the application that
|
* retrieving it, but it can be assured that the application that retrieves the information is
|
||||||
* retrieves the information is interested in that information. This is because
|
* interested in that information. This is because the messaging system has different Message
|
||||||
* the messaging system has different Message Channels for different types of
|
* Channels for different types of information the applications want to communicate. When an
|
||||||
* information the applications want to communicate. When an application sends
|
* application sends information, it doesn't randomly add the information to any channel available;
|
||||||
* information, it doesn't randomly add the information to any channel available;
|
* it adds it to a channel whose specific purpose is to communicate that sort of information.
|
||||||
* it adds it to a channel whose specific purpose is to communicate that sort of
|
* Likewise, an application that wants to receive particular information doesn't pull info off some
|
||||||
* information. Likewise, an application that wants to receive particular information
|
* random channel; it selects what channel to get information from based on what type of information
|
||||||
* doesn't pull info off some random channel; it selects what channel to get information
|
* it wants.
|
||||||
* from based on what type of information it wants.
|
|
||||||
* <p>
|
* <p>
|
||||||
* In this example we use Apache Camel to establish different Message Channels. The first
|
* In this example we use Apache Camel to establish different Message Channels. The first one reads
|
||||||
* one reads from standard input and delivers messages to Direct endpoints (Publish; Broadcast). The other Message
|
* from standard input and delivers messages to Direct endpoints (Publish; Broadcast). The other
|
||||||
* Channels are established from the Direct component to different Endpoints (Subscriber). No actual messages are sent,
|
* Message Channels are established from the Direct component to different Endpoints (Subscriber).
|
||||||
* only the established routes are printed to standard output.
|
* No actual messages are sent, only the established routes are printed to standard output.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Program entry point
|
* Program entry point
|
||||||
*
|
*
|
||||||
* @param args command line args
|
* @param args
|
||||||
* @throws Exception
|
* command line args
|
||||||
*/
|
* @throws Exception
|
||||||
public static void main(String[] args) throws Exception {
|
*/
|
||||||
CamelContext context = new DefaultCamelContext();
|
public static void main(String[] args) throws Exception {
|
||||||
|
CamelContext context = new DefaultCamelContext();
|
||||||
context.addRoutes(new RouteBuilder() {
|
|
||||||
|
|
||||||
@Override
|
context.addRoutes(new RouteBuilder() {
|
||||||
public void configure() throws Exception {
|
|
||||||
from("stream:in")
|
@Override
|
||||||
.multicast()
|
public void configure() throws Exception {
|
||||||
.to("direct:greetings1", "direct:greetings2", "direct:greetings3");
|
from("stream:in").multicast().to("direct:greetings1", "direct:greetings2",
|
||||||
}
|
"direct:greetings3");
|
||||||
});
|
}
|
||||||
|
});
|
||||||
context.start();
|
|
||||||
context.getRoutes().stream().forEach((r) -> System.out.println(r));
|
context.start();
|
||||||
context.stop();
|
context.getRoutes().stream().forEach((r) -> System.out.println(r));
|
||||||
}
|
context.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,9 @@ import org.junit.Test;
|
|||||||
*/
|
*/
|
||||||
public class AppTest {
|
public class AppTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
String[] args = {};
|
String[] args = {};
|
||||||
App.main(args);
|
App.main(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user