当前位置: 首页>>代码示例>>Java>>正文


Java Consume类代码示例

本文整理汇总了Java中org.apache.camel.Consume的典型用法代码示例。如果您正苦于以下问题:Java Consume类的具体用法?Java Consume怎么用?Java Consume使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Consume类属于org.apache.camel包,在下文中一共展示了Consume类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listen

import org.apache.camel.Consume; //导入依赖的package包/类
@Consume(uri = "activemq:queue:inbox?concurrentConsumers=10")
@RecipientList
public String listen(Exchange exchange) {
    topic.send(exchange);

    String type = exchange.getIn().getHeader("type", String.class);
    return "direct:" + type;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:RoutePojo.java

示例2: shouldDeployDefaultCamelContext

import org.apache.camel.Consume; //导入依赖的package包/类
private boolean shouldDeployDefaultCamelContext(Set<Bean<?>> beans) {
    return beans.stream()
        // Is there a Camel bean with the @Default qualifier?
        // Excluding internal components...
        .filter(bean -> !bean.getBeanClass().getPackage().equals(getClass().getPackage()))
        .filter(hasType(CamelContextAware.class).or(hasType(Component.class))
            .or(hasType(RouteContainer.class).or(hasType(RoutesBuilder.class))))
        .map(Bean::getQualifiers)
        .flatMap(Set::stream)
        .filter(isEqual(DEFAULT))
        .findAny()
        .isPresent()
        // Or a bean with Camel annotations?
        || concat(camelBeans.stream().map(AnnotatedType::getFields),
                  camelBeans.stream().map(AnnotatedType::getMethods))
        .flatMap(Set::stream)
        .map(Annotated::getAnnotations)
        .flatMap(Set::stream)
        .filter(isAnnotationType(Consume.class).and(a -> ((Consume) a).context().isEmpty())
            .or(isAnnotationType(BeanInject.class).and(a -> ((BeanInject) a).context().isEmpty()))
            .or(isAnnotationType(EndpointInject.class).and(a -> ((EndpointInject) a).context().isEmpty()))
            .or(isAnnotationType(Produce.class).and(a -> ((Produce) a).context().isEmpty()))
            .or(isAnnotationType(PropertyInject.class).and(a -> ((PropertyInject) a).context().isEmpty())))
        .findAny()
        .isPresent()
        // Or an injection point for Camel primitives?
        || beans.stream()
        // Excluding internal components...
        .filter(bean -> !bean.getBeanClass().getPackage().equals(getClass().getPackage()))
        .map(Bean::getInjectionPoints)
        .flatMap(Set::stream)
        .filter(ip -> getRawType(ip.getType()).getName().startsWith("org.apache.camel"))
        .map(InjectionPoint::getQualifiers)
        .flatMap(Set::stream)
        .filter(isAnnotationType(Uri.class).or(isAnnotationType(Mock.class)).or(isEqual(DEFAULT)))
        .findAny()
        .isPresent();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:39,代码来源:CdiCamelExtension.java

示例3: myMethod

import org.apache.camel.Consume; //导入依赖的package包/类
@Consume(uri = "activemq:Test.BindingQueue")
public void myMethod(@Headers Map<?, ?> headers, String body) {
    this.headers = headers;
    this.body = body;

    // now lets notify we've completed
    producer.sendBody("Completed");
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:MyBean.java

示例4: processAnnotatedType

import org.apache.camel.Consume; //导入依赖的package包/类
private void processAnnotatedType(@Observes ProcessAnnotatedType<?> pat) {
    if (pat.getAnnotatedType().isAnnotationPresent(Vetoed.class)) {
        pat.veto();
    }
    if (hasAnnotation(pat.getAnnotatedType(), Converter.class)) {
        converters.add(pat.getAnnotatedType().getJavaClass());
    }
    if (hasAnnotation(pat.getAnnotatedType(), BeanInject.class, Consume.class, EndpointInject.class, Produce.class, PropertyInject.class)) {
        camelBeans.add(pat.getAnnotatedType());
    }
    if (hasAnnotation(pat.getAnnotatedType(), Consume.class)) {
        eagerBeans.add(pat.getAnnotatedType());
    }
    if (hasAnnotation(pat.getAnnotatedType(), ImportResource.class)) {
        resources.add(pat.getAnnotatedType().getAnnotation(ImportResource.class));
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:CdiCamelExtension.java

示例5: handleTitle

import org.apache.camel.Consume; //导入依赖的package包/类
@Consume(uri = "seda:book")
public void handleTitle(String title) {
    Transactional tx = this.getClass().getAnnotation(Transactional.class);
    if (tx == null) {
        throw new IllegalStateException("Spring annotation-driven should have instrumented this class as @Transactional");
    }
    if (!"NEVER".equals(tx.propagation().name())) {
        throw new IllegalStateException("Should be NEVER propagation");
    }
    if (!tx.readOnly()) {
        throw new IllegalStateException("Should be read only");
    }

    if (!title.contains("in Action")) {
        throw new IllegalArgumentException("Not a book title we like");
    }

    producer.sendBody(title);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:AnnotatedConsumeImpl.java

示例6: route

import org.apache.camel.Consume; //导入依赖的package包/类
@Consume(uri = "activemq:personnel.records")
@RecipientList
public String[] route(@XPath("/person/city/text()") String city) {
    if (city.equals("London")) {
        LOG.info("Person is from EMEA region");
        return new String[] {"file:target/messages/emea/hr_pickup", 
                             "file:target/messages/emea/finance_pickup"};
    } else {
        LOG.info("Person is from AMER region");
        return new String[] {"file:target/messages/amer/hr_pickup",
                             "file:target/messages/amer/finance_pickup"};
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:DistributeRecordsBean.java

示例7: consumerInjection

import org.apache.camel.Consume; //导入依赖的package包/类
public void consumerInjection(Method method, Object bean, String beanName) {
    Consume consume = method.getAnnotation(Consume.class);
    if (consume != null && matchContext(consume.context())) {
        LOG.debug("Creating a consumer for: " + consume);
        subscribeMethod(method, bean, beanName, consume.uri(), consume.ref(), consume.property());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:CamelPostProcessorHelper.java

示例8: doSomething

import org.apache.camel.Consume; //导入依赖的package包/类
@Consume(uri = "activemq:queue:foo")
public void doSomething(@Header("JMSReplyTo") Destination jmsReplyTo, @Body String body) throws Exception {
    assertEquals("Hello World", body);

    String endpointName = "activemq:" + jmsReplyTo.toString();
    endpointName = endpointName.replaceAll("//", ":");

    tempName = endpointName;
    latch.countDown();

    template.sendBody(tempName, "Bye World");
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:JmsRequestReplyManualReplyTest.java

示例9: doSomething

import org.apache.camel.Consume; //导入依赖的package包/类
@Consume(uri = "activemq:queue:foo")
public void doSomething(@Header("JMSReplyTo") Destination jmsReplyTo, @Body String body) throws Exception {
    assertEquals("Hello World", body);

    String endpointName = "activemq:" + jmsReplyTo.toString();
    template.sendBody(endpointName, "Bye World");
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:JmsRequestReplyManualWithJMSReplyToTest.java

示例10: doSomething

import org.apache.camel.Consume; //导入依赖的package包/类
@Consume(uri = "direct:foo", context = "camel-2")
@RecipientList(context = "camel-2")
public String[] doSomething(String body) {
    LOG.info("Received body: " + body);

    return new String[]{"mock:foo", "mock:result"};
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:MyCamel2RecipientList.java

示例11: doSomething

import org.apache.camel.Consume; //导入依赖的package包/类
@Consume(uri = "direct:start")
public void doSomething(String body) {
    ObjectHelper.notNull(destination, "destination");

    LOG.info("Received body: " + body);
    destination.sendBody(body);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:MyConsumer.java

示例12: doSomething

import org.apache.camel.Consume; //导入依赖的package包/类
@Consume(uri = "direct:start", context = "camel-1")
public void doSomething(String body) {
    ObjectHelper.notNull(destination, "destination");

    LOG.info("Received body: " + body);
    destination.sendBody(body);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:MyCamel1Consumer.java

示例13: doSomething

import org.apache.camel.Consume; //导入依赖的package包/类
@Consume(uri = "direct:start", context = "camel-2")
public void doSomething(String body) {
    ObjectHelper.notNull(destination, "destination");

    LOG.info("Received body: " + body);
    destination.sendBody(body);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:MyCamel2Consumer.java

示例14: shouldDeployDefaultCamelContext

import org.apache.camel.Consume; //导入依赖的package包/类
private boolean shouldDeployDefaultCamelContext(BeanManager manager, Set<SyntheticBean<?>> beans) {
    // TODO: find a way to 'pre-filter' by refining the bean types passed to the bean manager
    return concat(manager.getBeans(Object.class, ANY).stream(), beans.stream())
        // Is there a Camel bean with the @Default qualifier?
        // Excluding internal components...
        .filter(bean -> !bean.getBeanClass().getPackage().equals(getClass().getPackage()))
        .filter(hasType(CamelContextAware.class).or(hasType(Component.class))
            .or(hasType(RouteContainer.class).or(hasType(RoutesBuilder.class))))
        .map(Bean::getQualifiers)
        .flatMap(Set::stream)
        .anyMatch(isEqual(DEFAULT))
        // Or a bean with Camel annotations?
        || concat(camelBeans.stream().map(AnnotatedType::getFields),
                  camelBeans.stream().map(AnnotatedType::getMethods))
        .flatMap(Set::stream)
        .map(Annotated::getAnnotations)
        .flatMap(Set::stream)
        .anyMatch(isAnnotationType(Consume.class).and(a -> ((Consume) a).context().isEmpty())
            .or(isAnnotationType(BeanInject.class).and(a -> ((BeanInject) a).context().isEmpty()))
            .or(isAnnotationType(EndpointInject.class).and(a -> ((EndpointInject) a).context().isEmpty()))
            .or(isAnnotationType(Produce.class).and(a -> ((Produce) a).context().isEmpty()))
            .or(isAnnotationType(PropertyInject.class).and(a -> ((PropertyInject) a).context().isEmpty())))
        // Or an injection point for Camel primitives?
        || concat(manager.getBeans(Object.class, ANY).stream(), beans.stream())
        // Excluding internal components...
        .filter(bean -> !bean.getBeanClass().getPackage().equals(getClass().getPackage()))
        .map(Bean::getInjectionPoints)
        .flatMap(Set::stream)
        .filter(ip -> getRawType(ip.getType()).getName().startsWith("org.apache.camel"))
        .map(InjectionPoint::getQualifiers)
        .flatMap(Set::stream)
        .anyMatch(isAnnotationType(Uri.class).or(isEqual(DEFAULT)));
}
 
开发者ID:astefanutti,项目名称:camel-cdi,代码行数:34,代码来源:CdiCamelExtension.java

示例15: addConsumeAnnotation

import org.apache.camel.Consume; //导入依赖的package包/类
private void addConsumeAnnotation(CtMethod ctMethod, String uri) {
	MethodInfo methodInfo = ctMethod.getMethodInfo();
	ConstPool constPool = methodInfo.getConstPool();

	Annotation consume = new Annotation(Consume.class.getName(), constPool);
	StringMemberValue valueVal = new StringMemberValue(constPool);
	valueVal.setValue(uri);
	consume.addMemberValue("uri", valueVal);

	AnnotationsAttribute attr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag);
	attr.addAnnotation(consume);
	methodInfo.addAttribute(attr);
}
 
开发者ID:statefulj,项目名称:statefulj,代码行数:14,代码来源:CamelBinder.java


注:本文中的org.apache.camel.Consume类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。