本文整理汇总了Java中org.apache.camel.component.seda.SedaEndpoint类的典型用法代码示例。如果您正苦于以下问题:Java SedaEndpoint类的具体用法?Java SedaEndpoint怎么用?Java SedaEndpoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SedaEndpoint类属于org.apache.camel.component.seda包,在下文中一共展示了SedaEndpoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testNotifyFrom
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Test
public void testNotifyFrom() throws Exception {
// use from to indicate it should only be messages originating from the given endpoint
NotifyBuilder notify = new NotifyBuilder(context)
.from("seda:order").whenDone(1).create();
template.sendBody("seda:quote", "Camel rocks");
template.sendBody("seda:order", "123,2010-04-20'T'15:47:59,4444,5555");
boolean matches = notify.matches(1, TimeUnit.SECONDS);
assertTrue(matches);
SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
assertEquals(1, confirm.getExchanges().size());
assertEquals("OK,123,2010-04-20'T'15:47:59,4444,5555", confirm.getExchanges().get(0).getIn().getBody());
}
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:17,代码来源:NotifyTest.java
示例2: testAdvisedMockEndpointsWithSkip
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
public void testAdvisedMockEndpointsWithSkip() throws Exception {
// advice the first route using the inlined AdviceWith route builder
// which has extended capabilities than the regular route builder
context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
// mock sending to direct:foo and skip send to it
mockEndpointsAndSkip("direct:foo");
}
});
getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
getMockEndpoint("mock:direct:foo").expectedMessageCount(1);
template.sendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
// the message was not send to the direct:foo route and thus not sent to the seda endpoint
SedaEndpoint seda = context.getEndpoint("seda:foo", SedaEndpoint.class);
assertEquals(0, seda.getCurrentQueueSize());
}
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:AdviceWithMockEndpointsWithSkipTest.java
示例3: testAdvisedMockEndpointsWithSkip
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
public void testAdvisedMockEndpointsWithSkip() throws Exception {
// advice the first route using the inlined AdviceWith route builder
// which has extended capabilities than the regular route builder
context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
// mock sending to direct:foo and direct:bar and skip send to it
mockEndpointsAndSkip("direct:foo", "direct:bar");
}
});
getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
getMockEndpoint("mock:direct:foo").expectedMessageCount(1);
getMockEndpoint("mock:direct:bar").expectedMessageCount(1);
template.sendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
// the message was not send to the direct:foo route and thus not sent to the seda endpoint
SedaEndpoint seda = context.getEndpoint("seda:foo", SedaEndpoint.class);
assertEquals(0, seda.getCurrentQueueSize());
}
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:AdviceWithMockMultipleEndpointsWithSkipTest.java
示例4: testErrorOkError
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
public void testErrorOkError() throws Exception {
getMockEndpoint("mock:error").expectedBodiesReceived("Kaboom");
getMockEndpoint("mock:start").expectedBodiesReceived("Kaboom", "World", "Kaboom");
getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
getMockEndpoint("mock:exception").expectedBodiesReceived("Kaboom", "Kaboom");
template.sendBody("direct:start", "Kaboom");
template.sendBody("direct:start", "World");
// give time for route to stop
Thread.sleep(1000);
assertEquals(ServiceStatus.Stopped, context.getRouteStatus("errorRoute"));
template.sendBody("direct:start", "Kaboom");
assertMockEndpointsSatisfied();
// should be 1 on the seda queue
SedaEndpoint seda = getMandatoryEndpoint("seda:error", SedaEndpoint.class);
SedaEndpoint seda2 = getMandatoryEndpoint("seda:error2", SedaEndpoint.class);
int size = seda.getQueue().size();
int size2 = seda2.getQueue().size();
assertTrue("There should be 1 exchange on the seda or seda2 queue", size == 1 || size2 == 1);
}
开发者ID:HydAu,项目名称:Camel,代码行数:25,代码来源:ContextScopedOnExceptionLoadBalancerStopRouteTest.java
示例5: createConsumer
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,
String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters) throws Exception {
// just use a seda endpoint for testing purpose
String id;
if (uriTemplate != null) {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
} else {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
}
// remove leading dash as we add that ourselves
if (id.startsWith("-")) {
id = id.substring(1);
}
if (configuration.getConsumerProperties() != null) {
String ref = (String) configuration.getConsumerProperties().get("dummy");
if (ref != null) {
dummy = CamelContextHelper.mandatoryLookup(camelContext, ref.substring(1));
}
}
SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
return seda.createConsumer(processor);
}
开发者ID:HydAu,项目名称:Camel,代码行数:26,代码来源:DummyRestConsumerFactory.java
示例6: createConsumer
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,
String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters) throws Exception {
// just use a seda endpoint for testing purpose
String id;
if (uriTemplate != null) {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
} else {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
}
// remove leading dash as we add that ourselves
if (id.startsWith("-")) {
id = id.substring(1);
}
SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
return seda.createConsumer(processor);
}
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:DummyRestConsumerFactory.java
示例7: testEndpointProperty
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Test
public void testEndpointProperty() throws Exception {
getMockEndpoint("mock:result").expectedMessageCount(2);
template.sendBody("ref:foo", "Hello World");
template.sendBody("ref:bar", "Bye World");
assertMockEndpointsSatisfied();
BlueprintCamelContext blue = context().adapt(BlueprintCamelContext.class);
SedaEndpoint foo = (SedaEndpoint) blue.getBlueprintContainer().getComponentInstance("foo");
assertNotNull(foo);
assertEquals(100, foo.getSize());
assertEquals(5000, foo.getPollTimeout());
assertEquals(true, foo.isBlockWhenFull());
assertEquals("seda://foo?blockWhenFull=true&pollTimeout=5000&size=100", foo.getEndpointUri());
SedaEndpoint bar = (SedaEndpoint) blue.getBlueprintContainer().getComponentInstance("bar");
assertNotNull(bar);
assertEquals(200, bar.getSize());
assertEquals("seda://bar?size=200", bar.getEndpointUri());
}
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:EndpointPropertyTest.java
示例8: createConsumer
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb,
String basePath, String uriTemplate, String consumes,
String produces, RestConfiguration configuration,
Map<String, Object> parameters) throws Exception {
// just use a seda endpoint for testing purpose
String id;
if (uriTemplate != null) {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
} else {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
}
// remove leading dash as we add that ourselves
if (id.startsWith("-")) {
id = id.substring(1);
}
SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
return seda.createConsumer(processor);
}
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:DummyRestConsumerFactory.java
示例9: testEndpointProperty
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
public void testEndpointProperty() throws Exception {
getMockEndpoint("mock:result").expectedMessageCount(2);
template.sendBody("ref:foo", "Hello World");
template.sendBody("ref:bar", "Bye World");
assertMockEndpointsSatisfied();
SedaEndpoint foo = applicationContext.getBean("foo", SedaEndpoint.class);
assertNotNull(foo);
assertEquals(100, foo.getSize());
assertEquals(5000, foo.getPollTimeout());
assertEquals(true, foo.isBlockWhenFull());
assertEquals("seda://foo?blockWhenFull=true&pollTimeout=5000&size=100", foo.getEndpointUri());
SedaEndpoint bar = applicationContext.getBean("bar", SedaEndpoint.class);
assertNotNull(bar);
assertEquals(200, bar.getSize());
assertEquals("seda://bar?size=200", bar.getEndpointUri());
}
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:SpringEndpointPropertyTest.java
示例10: installSizeMonitoring
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
private ExecutorService installSizeMonitoring(final Endpoint endpoint) {
final ScheduledExecutorService service = context.getExecutorServiceManager()
.newScheduledThreadPool(this, "SizeMonitoringThread", 1);
endpointSizeQueue.clear();
final Runnable monitoring = new Runnable() {
@Override
public void run() {
if (endpoint instanceof SedaEndpoint) {
final SedaEndpoint sedaEndpoint = (SedaEndpoint)endpoint;
endpointSizeQueue.offer(sedaEndpoint.getCurrentQueueSize());
} else if (endpoint instanceof DisruptorEndpoint) {
final DisruptorEndpoint disruptorEndpoint = (DisruptorEndpoint)endpoint;
long remainingCapacity = 0;
try {
remainingCapacity = disruptorEndpoint.getRemainingCapacity();
} catch (DisruptorNotStartedException e) {
//ignore
}
endpointSizeQueue.offer((int)(disruptorEndpoint.getBufferSize() - remainingCapacity));
}
}
};
service.scheduleAtFixedRate(monitoring, 0, 100, TimeUnit.MILLISECONDS);
return service;
}
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:SedaDisruptorCompareTest.java
示例11: testPositive
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Test
@Override
public void testPositive() throws Exception {
assertEquals(ServiceStatus.Started, camelContext.getStatus());
assertEquals(ServiceStatus.Started, camelContext2.getStatus());
mockA.expectedBodiesReceived("David");
mockB.expectedBodiesReceived("Hello David");
mockC.expectedBodiesReceived("David");
mock.expectedBodiesReceived("Hello David");
start.sendBody("David");
start2.sendBody("David");
MockEndpoint.assertIsSatisfied(camelContext);
MockEndpoint.assertIsSatisfied(camelContext2);
assertTrue("Original endpoint should be invoked", ((SedaEndpoint) original.getDelegate()).getExchanges().size() == 1);
}
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:CamelSpringRunnerMockEndpointsTest.java
示例12: testPositive
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Test
@Override
public void testPositive() throws Exception {
assertEquals(ServiceStatus.Started, camelContext.getStatus());
assertEquals(ServiceStatus.Started, camelContext2.getStatus());
mockA.expectedBodiesReceived("David");
mockB.expectedBodiesReceived("Hello David");
mock.expectedBodiesReceived("Hello David");
start.sendBody("David");
start2.sendBody("David");
MockEndpoint.assertIsSatisfied(camelContext);
MockEndpoint.assertIsSatisfied(camelContext2);
assertTrue("Original endpoint was invoked", ((SedaEndpoint) original.getDelegate()).getExchanges().isEmpty());
}
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:CamelSpringRunnerMockEndpointsAndSkipTest.java
示例13: testNotifyFrom
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Test
public void testNotifyFrom() throws Exception {
// use from to indicate it should only be messages originating from the given endpoint
NotifyBuilder notify = new NotifyBuilder(context)
.from("seda:order").whenDone(1).create();
template.sendBody("seda:quote", "Camel rocks");
template.sendBody("seda:order", "123,2017-04-20'T'15:47:59,4444,5555");
boolean matches = notify.matches(5, TimeUnit.SECONDS);
assertTrue(matches);
SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
assertEquals(1, confirm.getExchanges().size());
assertEquals("OK,123,2017-04-20'T'15:47:59,4444,5555", confirm.getExchanges().get(0).getIn().getBody());
}
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:17,代码来源:NotifyTest.java
示例14: testNotifyWhenAnyDoneMatches
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Test
public void testNotifyWhenAnyDoneMatches() throws Exception {
// use a predicate to indicate when a certain message is done
NotifyBuilder notify = new NotifyBuilder(context)
.from("seda:order").whenAnyDoneMatches(body().isEqualTo("OK,123,2017-04-20'T'15:48:00,2222,3333")).create();
// send in 2 messages. Its the 2nd message we want to test
template.sendBody("seda:order", "123,2017-04-20'T'15:47:59,4444,5555");
template.sendBody("seda:order", "123,2017-04-20'T'15:48:00,2222,3333");
boolean matches = notify.matches(5, TimeUnit.SECONDS);
assertTrue(matches);
SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
// there should be 2 messages on the confirm queue
assertEquals(2, confirm.getExchanges().size());
// and the 2nd message should be the message we wanted to test for
assertEquals("OK,123,2017-04-20'T'15:48:00,2222,3333", confirm.getExchanges().get(1).getIn().getBody());
}
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:20,代码来源:NotifyTest.java
示例15: testNotifyFrom
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Test
public void testNotifyFrom() throws Exception {
// use from to indicate it should only be messages originating from the given endpoint
NotifyBuilder notify = new NotifyBuilder(context)
.from("seda:order").whenDone(1).create();
template.sendBody("seda:quote", "Camel rocks");
template.sendBody("seda:order", "123,2010-04-20'T'15:47:59,4444,5555");
boolean matches = notify.matches(5, TimeUnit.SECONDS);
assertTrue(matches);
SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
assertEquals(1, confirm.getExchanges().size());
assertEquals("OK,123,2010-04-20'T'15:47:59,4444,5555", confirm.getExchanges().get(0).getIn().getBody());
}
开发者ID:camelinaction,项目名称:camelinaction,代码行数:17,代码来源:NotifyTest.java
示例16: testNotifyWhenAnyDoneMatches
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Test
public void testNotifyWhenAnyDoneMatches() throws Exception {
// use a predicate to indicate when a certain message is done
NotifyBuilder notify = new NotifyBuilder(context)
.from("seda:order").whenAnyDoneMatches(body().isEqualTo("OK,123,2010-04-20'T'15:48:00,2222,3333")).create();
// send in 2 messages. Its the 2nd message we want to test
template.sendBody("seda:order", "123,2010-04-20'T'15:47:59,4444,5555");
template.sendBody("seda:order", "123,2010-04-20'T'15:48:00,2222,3333");
boolean matches = notify.matches(5, TimeUnit.SECONDS);
assertTrue(matches);
SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
// there should be 2 messages on the confirm queue
assertEquals(2, confirm.getExchanges().size());
// and the 2nd message should be the message we wanted to test for
assertEquals("OK,123,2010-04-20'T'15:48:00,2222,3333", confirm.getExchanges().get(1).getIn().getBody());
}
开发者ID:camelinaction,项目名称:camelinaction,代码行数:20,代码来源:NotifyTest.java
示例17: createConsumer
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb,
String basePath, String uriTemplate, String consumes,
String produces, RestConfiguration configuration,
Map<String, Object> parameters) throws Exception {
// just use a seda endpoint for testing purpose
String id;
if (uriTemplate != null)
id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
else
id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
// remove leading dash as we add that ourselves
if (id.startsWith("-"))
id = id.substring(1);
SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
return seda.createConsumer(processor);
}
开发者ID:astefanutti,项目名称:camel-cdi,代码行数:19,代码来源:DummyRestConsumerFactory.java
示例18: runTest
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
private void runTest(OrchestratedTestSpecification spec) throws Exception {
Collection<Endpoint> endpoints = context.getEndpoints();
for (Endpoint endpoint : endpoints) {
if (endpoint instanceof SedaEndpoint) ((SedaEndpoint) endpoint).setPurgeWhenStopping(true);
}
AssertionError e = null;
try {
MorcTest test = new MorcTest(spec);
test.setUp();
test.runOrchestratedTest();
} catch (AssertionError ex) {
if (!ex.getMessage().contains("Received message count. Expected"))
e = ex;
logger.info("Exception ({}): ", spec.getDescription(), e);
}
assertNotNull(e);
}
开发者ID:uoa-group-applications,项目名称:morc,代码行数:21,代码来源:EachCaseMultiExpectationSyncFailureTest.java
示例19: testConsumerTemplateSedaQueue
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
public void testConsumerTemplateSedaQueue() throws Exception {
template.sendBody("direct:start", "A");
template.sendBody("direct:start", "B");
template.sendBody("direct:start", "C");
template.sendBody("direct:start", "D");
template.sendBody("direct:start", "E");
SedaEndpoint seda = context.getEndpoint("seda:foo", SedaEndpoint.class);
assertEquals(5, seda.getCurrentQueueSize());
String body = consumer.receiveBody(seda, 1000, String.class);
assertEquals("A", body);
assertEquals(4, seda.getCurrentQueueSize());
body = consumer.receiveBody(seda, 1000, String.class);
assertEquals("B", body);
assertEquals(3, seda.getCurrentQueueSize());
body = consumer.receiveBody(seda, 1000, String.class);
assertEquals("C", body);
assertEquals(2, seda.getCurrentQueueSize());
body = consumer.receiveBody(seda, 1000, String.class);
assertEquals("D", body);
assertEquals(1, seda.getCurrentQueueSize());
body = consumer.receiveBody(seda, 1000, String.class);
assertEquals("E", body);
assertEquals(0, seda.getCurrentQueueSize());
}
开发者ID:HydAu,项目名称:Camel,代码行数:31,代码来源:ConsumerTemplateSedaQueueIssueTest.java
示例20: createRouteBuilder
import org.apache.camel.component.seda.SedaEndpoint; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
// put a message pre-early on the seda queue, to trigger the route, which
// then would add a 2nd route during CamelContext startup. This is a test
// to ensure the foo route is not started too soon, and thus adding the 2nd
// route works as expected
SedaEndpoint seda = context.getEndpoint("seda:start", SedaEndpoint.class);
seda.getQueue().put(new DefaultExchange(context));
from("seda:start").routeId("foo")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
RouteBuilder child = new RouteBuilder() {
@Override
public void configure() throws Exception {
from("seda:bar").routeId("bar").to("mock:bar");
}
};
context.addRoutes(child);
}
})
.to("mock:result");
}
};
}
开发者ID:HydAu,项目名称:Camel,代码行数:30,代码来源:ManagedRouteAddFromRouteTest.java
注:本文中的org.apache.camel.component.seda.SedaEndpoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论