com.consol.citrus.vertx.endpoint.VertxConsumer Maven / Gradle / Ivy
/*
* Copyright 2006-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.consol.citrus.vertx.endpoint;
import com.consol.citrus.context.TestContext;
import com.consol.citrus.exceptions.MessageTimeoutException;
import com.consol.citrus.message.Message;
import com.consol.citrus.messaging.AbstractMessageConsumer;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.eventbus.MessageConsumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Christoph Deppisch
* @since 1.4.1
*/
public class VertxConsumer extends AbstractMessageConsumer {
/** Vert.x instance */
private final Vertx vertx;
/** Endpoint configuration */
private final VertxEndpointConfiguration endpointConfiguration;
/** Logger */
private static Logger log = LoggerFactory.getLogger(VertxConsumer.class);
/** Retry logger */
private static final Logger RETRY_LOG = LoggerFactory.getLogger("com.consol.citrus.RetryLogger");
/**
* Default constructor using endpoint.
* @param name
* @param vertx
* @param endpointConfiguration
*/
public VertxConsumer(String name, Vertx vertx, VertxEndpointConfiguration endpointConfiguration) {
super(name, endpointConfiguration);
this.vertx = vertx;
this.endpointConfiguration = endpointConfiguration;
}
@Override
public Message receive(TestContext context, long timeout) {
if (log.isDebugEnabled()) {
log.debug("Receiving message on Vert.x event bus address: '" + endpointConfiguration.getAddress() + "'");
}
VertxSingleMessageHandler vertxMessageHandler = new VertxSingleMessageHandler();
MessageConsumer
© 2015 - 2025 Weber Informatics LLC | Privacy Policy