コード例 #1
0
 public ConfigViewModel() {
   super();
   producer = CamelContextFactory.getInstance().createProducerTemplate();
   producer.setDefaultEndpointUri("seda:input");
   allListMap = new TreeMap<String, String>();
   selectedListArray = new ArrayList<String>();
 }
コード例 #2
0
  @Activate
  public synchronized void activate(Map<?, ?> properties) throws Exception {
    LOG.info("Activating: " + COMPONENT_LABEL);

    try {
      rwl.writeLock().lock();
      LOG.info(properties.toString());

      LOG.info("Activating the Producer Endpoint");
      producer = camelContext.createProducerTemplate();
      producer.setDefaultEndpointUri((String) properties.get("endpointUri"));
      producer.start();
    } finally {
      rwl.writeLock().unlock();
    }
  }
コード例 #3
0
  @GET()
  @Produces("text/plain")
  @SuppressWarnings("unchecked")
  public String getCreditScore() {
    String creditScore = "-1";
    CamelContext context = new DefaultCamelContext();
    String body =
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?><creditform id=\"1\"><firstName>David</firstName><lastName>Suzuki</lastName><city>Toronto</city><scoreType>OMNI</scoreType></creditform>";

    try {
      context.start();
      Thread.sleep(5000);
      creditScoreProducer = context.createProducerTemplate();
      creditScoreProducer.setDefaultEndpointUri("activemq:creditscorereqs");
      Future futureObj =
          creditScoreProducer.asyncRequestBody(creditScoreProducer.getDefaultEndpoint(), body);
      List<CreditScoreResponse> response =
          creditScoreProducer.extractFutureBody(futureObj, List.class);
      if (response != null && response.size() > 0) {
        Iterator<CreditScoreResponse> it = response.iterator();
        while (it.hasNext()) {
          CreditScoreResponse scoreResp = (CreditScoreResponse) it.next();
          logger.info("Your borrower application form id: " + scoreResp.getBorrowerFormId());
          logger.info("Your application credit score(s): " + scoreResp.getCreditScore());
          creditScore = scoreResp.getCreditScore();
        }
      } else logger.info("Your application credit score(s): 0");

    } catch (Exception e) {
      logger.error("Error processing credit score: " + e);
      e.printStackTrace();
    } finally {
      try {
      } catch (Exception ex) {
        ex.printStackTrace();
      }
    }

    return "Your score: " + creditScore;
  }
コード例 #4
0
 public CamelUdpNettyHandler(String outputType) throws Exception {
   this.outputType = outputType;
   producer = new DefaultProducerTemplate(CamelContextFactory.getInstance());
   producer.setDefaultEndpointUri(RouteManager.SEDA_INPUT);
   producer.start();
 }