org.apache.camel.cdi.Uri.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中org.apache.camel.cdi.Uri.<init>()方法的一些代码示例,展示了Uri.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Uri.<init>()方法的具体详情如下:
包路径:org.apache.camel.cdi.Uri
类名称:Uri
方法名:<init>

Uri.<init>介绍

暂无

代码示例

代码示例来源:origin: camelinaction/camelinaction2

/**
 * Camel routes that uses undertow to expose a HTTP service
 */
@Singleton
public class HelloRoute extends RouteBuilder {

  @Inject @Uri("undertow:http://0.0.0.0:8080/")
  private Endpoint undertow;

  @Inject
  private HelloBean hello;

  @Override
  public void configure() throws Exception {
    from(undertow).bean(hello);
  }
}

代码示例来源:origin: camelinaction/camelinaction2

/**
 * Camel routes that uses undertow to expose a HTTP service
 */
@Singleton
public class HelloRoute extends RouteBuilder {

  @Inject @Uri("undertow:http://0.0.0.0:8080/")
  private Endpoint undertow;

  @Inject
  private HelloBean hello;

  @Override
  public void configure() throws Exception {
    from(undertow).bean(hello);
  }
}

代码示例来源:origin: camelinaction/camelinaction2

/**
 * A basic route that exposes a HTTP service.
 * This route uses CDI dependency injection.
 */
@Singleton
public class HelloRoute extends RouteBuilder {

  // use CDI @Inject to inject the bean of type HelloBean
  @Inject
  private HelloBean hello;

  // use camel-cdi @Uri to inject the endpoint
  @Inject @Uri("jetty:http://localhost:8080/hello")
  private Endpoint jetty;

  @Override
  public void configure() throws Exception {
    from(jetty)
      // call the sayHello method on the hello bean
      .bean(hello, "sayHello");
  }
}

代码示例来源:origin: camelinaction/camelinaction2

/**
 * A basic route that exposes a HTTP service.
 * This route uses CDI dependency injection.
 */
@Singleton
public class HelloRoute extends RouteBuilder {

  // use CDI @Inject to inject the bean of type HelloBean
  @Inject
  private HelloBean hello;

  // use camel-cdi @Uri to inject the endpoint
  // use undertow as HTTP server as WildFly Swarm comes out of the box with Undertow
  @Inject @Uri("undertow:http://localhost:8080/hello")
  private Endpoint undertow;

  @Override
  public void configure() throws Exception {
    from(undertow)
      // call the sayHello method on the hello bean
      .bean(hello, "sayHello");
  }
}

代码示例来源:origin: io.fabric8.jube.images.fabric8/quickstart-java-camel-cdi-rest

/**
 * Configures all our Camel routes, components, endpoints and beans
 */
@ContextName("myCdiRestCamelContext")
public class MyRoutes extends RouteBuilder {

  @Inject
  @Uri("timer:foo?period=5000")
  private Endpoint inputEndpoint;

  @Inject
  @Uri("http:{{service:QUICKSTART_REST:localhost:8080}}/cxf/customerservice/customers/123")
  private Endpoint restEndpoint;

  @Inject
  @Uri("log:output?showExchangePattern=false&showBodyType=false&showStreams=true")
  private Endpoint resultEndpoint;

  @Override
  public void configure() throws Exception {
    // you can configure the route rule with Java DSL here

    from(inputEndpoint)
      .to(restEndpoint)
      .to(resultEndpoint);
  }

}

代码示例来源:origin: org.apache.camel/camel-cdi

@Produces
@Default @Uri("")
// Qualifiers are dynamically added in CdiCamelExtension
private static FluentProducerTemplate fluentProducerTemplate(InjectionPoint ip, @Any Instance<CamelContext> instance, CdiCamelExtension extension) {
  return getQualifierByType(ip, Uri.class)
    .map(uri -> fluentProducerTemplateFromUri(ip, instance, extension, uri))
    .orElseGet(() -> defaultFluentProducerTemplate(ip, instance, extension));
}

代码示例来源:origin: org.apache.camel/camel-cdi

@Produces
@Default @Uri("")
// Qualifiers are dynamically added in CdiCamelExtension
private static ProducerTemplate producerTemplate(InjectionPoint ip, @Any Instance<CamelContext> instance, CdiCamelExtension extension) {
  return getQualifierByType(ip, Uri.class)
    .map(uri -> producerTemplateFromUri(ip, instance, extension, uri))
    .orElseGet(() -> defaultProducerTemplate(ip, instance, extension));
}

代码示例来源:origin: net.osgiliath.samples/net.osgiliath.sample.webapp.business.impl

@Uri("jms:topic:helloServiceQueueOut")
private ProducerTemplate producer;

代码示例来源:origin: io.astefanutti.camel.cdi/simplecontextname

@Uri("direct:continue")
@ContextName("simple")
private Endpoint directEP;

代码示例来源:origin: org.apache.camel/camel-cdi

@Uri("")
@Produces
// Qualifiers are dynamically added in CdiCamelExtension
private static Endpoint endpoint(InjectionPoint ip, @Any Instance<CamelContext> instance, CdiCamelExtension extension) {
  Uri uri = getQualifierByType(ip, Uri.class).get();
  try {
    CamelContext context = uri.context().isEmpty()
      ? selectContext(ip, instance, extension)
      : selectContext(uri.context(), instance);
    return context.getEndpoint(uri.value(), Endpoint.class);
  } catch (Exception cause) {
    throw new InjectionException("Error injecting endpoint annotated with " + uri + " into " + ip, cause);
  }
}

代码示例来源:origin: org.apache.camel/camel-cdi

@Uri("")
@Produces
@Typed(MockEndpoint.class)
// Qualifiers are dynamically added in CdiCamelExtension
private static MockEndpoint mockEndpointFromUri(InjectionPoint ip, @Any Instance<CamelContext> instance, CdiCamelExtension extension) {
  Uri uri = getQualifierByType(ip, Uri.class).get();
  try {
    CamelContext context = uri.context().isEmpty()
      ? selectContext(ip, instance, extension)
      : selectContext(uri.context(), instance);
    return context.getEndpoint(uri.value(), MockEndpoint.class);
  } catch (Exception cause) {
    throw new InjectionException("Error injecting mock endpoint annotated with " + uri
      + " into " + ip, cause);
  }
}

相关文章

微信公众号

最新文章

更多

Uri类方法