use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class VelocityFileLetterWithPropertyTest method createRegistry.
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry registry = new JndiRegistry(createJndiContext());
registry.bind("properties", new PropertiesComponent());
return registry;
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class CamelRouterBuilder method main.
/**
* Allow this route to be run as an application
*/
public static void main(String[] args) throws Exception {
System.setProperty("soapEndpointPort", "9006");
System.setProperty("restEndpointPort", "9002");
CamelContext context = new DefaultCamelContext();
PropertiesComponent pc = new PropertiesComponent();
context.addComponent("properties", pc);
context.start();
context.addRoutes(new CamelRouterBuilder());
Thread.sleep(1000);
// JAXWSClient invocation
JAXWSClient jaxwsClient = new JAXWSClient();
BookStore bookStore = jaxwsClient.getBookStore();
bookStore.addBook(new Book("Camel User Guide", 123L));
Book book = bookStore.getBook(123L);
System.out.println("Get the book with id 123. " + book);
try {
book = bookStore.getBook(124L);
System.out.println("Get the book with id 124. " + book);
} catch (Exception exception) {
System.out.println("Expected exception received: " + exception);
}
// JAXRSClient invocation
JAXRSClient jaxrsClient = new JAXRSClient();
bookStore = jaxrsClient.getBookStore();
bookStore.addBook(new Book("Karaf User Guide", 124L));
book = bookStore.getBook(124L);
System.out.println("Get the book with id 124. " + book);
try {
book = bookStore.getBook(126L);
System.out.println("Get the book with id 126. " + book);
} catch (Exception exception) {
System.out.println("Expected exception received: " + exception);
}
Thread.sleep(1000);
context.stop();
System.exit(0);
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class CamelCxfExample method main.
public static void main(String[] args) throws Exception {
// Set system properties for use with Camel property placeholders for running the examples.
System.setProperty("routerPort", "9001");
System.setProperty("servicePort", "9003");
// START SNIPPET: e1
CamelContext context = new DefaultCamelContext();
// END SNIPPET: e1
PropertiesComponent pc = new PropertiesComponent();
context.addComponent("properties", pc);
// Set up the JMS broker and the CXF SOAP over JMS server
// START SNIPPET: e2
JmsBroker broker = new JmsBroker();
Server server = new Server();
try {
broker.start();
server.start();
// END SNIPPET: e2
// Add some configuration by hand ...
// START SNIPPET: e3
context.addRoutes(new RouteBuilder() {
public void configure() {
CxfComponent cxfComponent = new CxfComponent(getContext());
CxfEndpoint serviceEndpoint = new CxfEndpoint(SERVICE_ADDRESS, cxfComponent);
serviceEndpoint.setServiceClass(Greeter.class);
// Here we just pass the exception back, don't need to use errorHandler
errorHandler(noErrorHandler());
from(ROUTER_ENDPOINT_URI).to(serviceEndpoint);
}
});
// END SNIPPET: e3
String address = ROUTER_ADDRESS.replace("{{routerPort}}", System.getProperty("routerPort"));
// Starting the routing context
// Using the CXF Client to kick off the invocations
// START SNIPPET: e4
context.start();
Client client = new Client(address + "?wsdl");
// END SNIPPET: e4
// Now everything is set up - let's start the context
client.invoke();
Thread.sleep(1000);
context.stop();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
server.stop();
broker.stop();
System.exit(0);
}
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class SplunkPublishEventRouteBuilder method configure.
@Override
public void configure() throws Exception {
log.info("About to start route: direct --> Splunk Server");
// configure properties component
PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
pc.setLocation("classpath:application.properties");
from("direct:start").convertBodyTo(SplunkEvent.class).to("splunk://submit?host={{splunk.host}}&port={{splunk.port}}" + "&username={{splunk.username}}&password={{splunk.password}}&sourceType=secure&source=myAppName");
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class SplunkSavedSearchRouteBuilder method configure.
@Override
public void configure() throws Exception {
log.info("About to setup Splunk 'saved-search' route:Splunk Server --> log{results}");
// configure properties component
PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
pc.setLocation("classpath:application.properties");
from("splunk://savedsearch?host={{splunk.host}}&port={{splunk.port}}&delay=10s" + "&username={{splunk.username}}&password={{splunk.password}}&initEarliestTime=08/17/13 08:35:46:456" + "&savedSearch=failed_password").log("${body}");
}
Aggregations