
io.vertx.core.eventbus.MessageProducer Maven / Gradle / Ivy
/*
* Copyright (c) 2011-2013 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.core.eventbus;
import io.vertx.codegen.annotations.Fluent;
import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.streams.WriteStream;
/**
* Represents a stream of message that can be written to.
*
*
* @author Julien Viet
*/
@VertxGen
public interface MessageProducer extends WriteStream {
int DEFAULT_WRITE_QUEUE_MAX_SIZE = 1000;
/**
* Synonym for {@link #write(Object)}.
*
* @param message the message to send
* @return reference to this for fluency
*/
MessageProducer send(T message);
MessageProducer send(T message, Handler>> replyHandler);
@Override
MessageProducer exceptionHandler(Handler handler);
@Override
MessageProducer write(T data);
@Override
MessageProducer setWriteQueueMaxSize(int maxSize);
@Override
MessageProducer drainHandler(Handler handler);
/**
* Update the delivery options of this producer.
*
* @param options the new options
* @return this producer object
*/
@Fluent
MessageProducer deliveryOptions(DeliveryOptions options);
/**
* @return The address to which the producer produces messages.
*/
String address();
/**
* Closes the producer, calls {@link #close()}
*/
@Override
void end();
/**
* Closes the producer, this method should be called when the message producer is not used anymore.
*/
void close();
}