io.vertx.camel.impl.FromVertxToCamelProducer Maven / Gradle / Ivy
/*
* Copyright (c) 2011-2015 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.vertx.camel.impl;
import io.vertx.camel.OutboundMapping;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.WorkerExecutor;
import io.vertx.core.eventbus.DeliveryOptions;
import io.vertx.core.eventbus.ReplyFailure;
import org.apache.camel.*;
import org.apache.camel.support.AsyncProcessorConverterHelper;
/**
* Handles the transfer from Vert.x message to Camel (outbound).
*/
public class FromVertxToCamelProducer implements Handler> {
private final Endpoint endpoint;
private final AsyncProcessor producer;
private final OutboundMapping outbound;
private final boolean blocking;
private final Vertx vertx;
private final WorkerExecutor pool;
/**
* Creates a new instance of producer.
*
* @param vertx the vert.x instance
* @param producer the underlying producer, must not be {@code null}
* @param outbound the outbound configuration, must not be {@code null}
* @param blocking whether or not the processing is blocking and so should not be run on the event
* loop
* @param pool the pool on which the blocking code is going to be executed
*/
public FromVertxToCamelProducer(Vertx vertx, Producer producer, OutboundMapping outbound, boolean blocking,
WorkerExecutor pool) {
this.endpoint = producer.getEndpoint();
this.producer = AsyncProcessorConverterHelper.convert(producer);
this.outbound = outbound;
this.blocking = blocking;
this.vertx = vertx;
this.pool = pool;
}
@Override
public void handle(io.vertx.core.eventbus.Message
© 2015 - 2024 Weber Informatics LLC | Privacy Policy