/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you 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 io.vertx.reactivex.amqp;

import io.vertx.reactivex.RxHelper;
import io.vertx.reactivex.ObservableHelper;
import io.vertx.reactivex.FlowableHelper;
import io.vertx.reactivex.impl.AsyncResultMaybe;
import io.vertx.reactivex.impl.AsyncResultSingle;
import io.vertx.reactivex.impl.AsyncResultCompletable;
import io.vertx.reactivex.WriteStreamObserver;
import io.vertx.reactivex.WriteStreamSubscriber;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;

Represents an AMQP message.

Reference about the different metadata can be found on AMQP message properties.

Note that the body is retrieved using body* method depending on the expected type.

NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.
/** * Represents an AMQP message. * <p> * Reference about the different metadata can be found on * <a href="http://docs.oasis-open.org/amqp/core/v1.0/amqp-core-messaging-v1.0.html#type-properties">AMQP message properties</a>. * <p> * Note that the body is retrieved using <code>body*</code> method depending on the expected type. * * <p/> * NOTE: This class has been automatically generated from the {@link io.vertx.amqp.AmqpMessage original} non RX-ified interface using Vert.x codegen. */
@RxGen(io.vertx.amqp.AmqpMessage.class) public class AmqpMessage { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AmqpMessage that = (AmqpMessage) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final TypeArg<AmqpMessage> __TYPE_ARG = new TypeArg<>( obj -> new AmqpMessage((io.vertx.amqp.AmqpMessage) obj), AmqpMessage::getDelegate ); private final io.vertx.amqp.AmqpMessage delegate; public AmqpMessage(io.vertx.amqp.AmqpMessage delegate) { this.delegate = delegate; } public AmqpMessage(Object delegate) { this.delegate = (io.vertx.amqp.AmqpMessage)delegate; } public io.vertx.amqp.AmqpMessage getDelegate() { return delegate; }
Returns:a builder to create an AmqpMessage.
/** * @return a builder to create an {@link io.vertx.reactivex.amqp.AmqpMessage}. */
public static io.vertx.reactivex.amqp.AmqpMessageBuilder create() { io.vertx.reactivex.amqp.AmqpMessageBuilder ret = io.vertx.reactivex.amqp.AmqpMessageBuilder.newInstance((io.vertx.amqp.AmqpMessageBuilder)io.vertx.amqp.AmqpMessage.create()); return ret; }
Creates a builder to create a new AmqpMessage copying the metadata from the passed message.
Params:
  • existing – an existing message, must not be null.
Returns:a builder to create an AmqpMessage.
/** * Creates a builder to create a new {@link io.vertx.reactivex.amqp.AmqpMessage} copying the metadata from the passed message. * @param existing an existing message, must not be <code>null</code>. * @return a builder to create an {@link io.vertx.reactivex.amqp.AmqpMessage}. */
public static io.vertx.reactivex.amqp.AmqpMessageBuilder create(io.vertx.reactivex.amqp.AmqpMessage existing) { io.vertx.reactivex.amqp.AmqpMessageBuilder ret = io.vertx.reactivex.amqp.AmqpMessageBuilder.newInstance((io.vertx.amqp.AmqpMessageBuilder)io.vertx.amqp.AmqpMessage.create(existing.getDelegate())); return ret; }
Returns:whether or not the message is durable.
/** * @return whether or not the message is durable. */
public boolean isDurable() { boolean ret = delegate.isDurable(); return ret; }
Returns:if true, then this message has not been acquired by any other link. If false, then this message MAY have previously been acquired by another link or links.
/** * @return if <code>true</code>, then this message has not been acquired by any other link. If <code>false</code>, then this message MAY have previously been acquired by another link or links. */
public boolean isFirstAcquirer() { boolean ret = delegate.isFirstAcquirer(); return ret; }
Returns:the relative message priority. Higher numbers indicate higher priority messages. Messages with higher priorities MAY be delivered before those with lower priorities.
/** * @return the relative message priority. Higher numbers indicate higher priority messages. Messages with higher priorities MAY be delivered before those with lower priorities. */
public int priority() { int ret = delegate.priority(); return ret; }
Returns:the number of unsuccessful previous attempts to deliver this message. If this value is non-zero it can be taken as an indication that the delivery might be a duplicate. On first delivery, the value is zero. It is incremented upon an outcome being settled at the sender, according to rules defined for each outcome.
/** * @return the number of unsuccessful previous attempts to deliver this message. If this value is non-zero it can be taken as an indication that the delivery might be a duplicate. On first delivery, the value is zero. It is incremented upon an outcome being settled at the sender, according to rules defined for each outcome. */
public int deliveryCount() { int ret = delegate.deliveryCount(); return ret; }
Returns:the duration in milliseconds for which the message is to be considered "live".
/** * @return the duration in milliseconds for which the message is to be considered "live". */
public long ttl() { long ret = delegate.ttl(); return ret; }
Returns:the message id
/** * @return the message id */
public String id() { String ret = delegate.id(); return ret; }
Returns:the message address, also named to field
/** * @return the message address, also named <code>to</code> field */
public String address() { String ret = delegate.address(); return ret; }
Returns:The address of the node to send replies to, if any.
/** * @return The address of the node to send replies to, if any. */
public String replyTo() { String ret = delegate.replyTo(); return ret; }
Returns:The client-specific id that can be used to mark or identify messages between clients.
/** * @return The client-specific id that can be used to mark or identify messages between clients. */
public String correlationId() { String ret = delegate.correlationId(); return ret; }
Returns:whether the body is null. This method returns true is the message does not contain a body or if the message contain a null AMQP value as body.
/** * @return whether the body is <code>null</code>. This method returns <code>true</code> is the message does not contain a body or if the message contain a <code>null</code> AMQP value as body. */
public boolean isBodyNull() { boolean ret = delegate.isBodyNull(); return ret; }
Returns:the boolean value contained in the body. The value must be passed as AMQP value.
/** * @return the boolean value contained in the body. The value must be passed as AMQP value. */
public boolean bodyAsBoolean() { boolean ret = delegate.bodyAsBoolean(); return ret; }
Returns:the byte value contained in the body. The value must be passed as AMQP value.
/** * @return the byte value contained in the body. The value must be passed as AMQP value. */
public byte bodyAsByte() { byte ret = delegate.bodyAsByte(); return ret; }
Returns:the short value contained in the body. The value must be passed as AMQP value.
/** * @return the short value contained in the body. The value must be passed as AMQP value. */
public short bodyAsShort() { short ret = delegate.bodyAsShort(); return ret; }
Returns:the integer value contained in the body. The value must be passed as AMQP value.
/** * @return the integer value contained in the body. The value must be passed as AMQP value. */
public int bodyAsInteger() { int ret = delegate.bodyAsInteger(); return ret; }
Returns:the long value contained in the body. The value must be passed as AMQP value.
/** * @return the long value contained in the body. The value must be passed as AMQP value. */
public long bodyAsLong() { long ret = delegate.bodyAsLong(); return ret; }
Returns:the float value contained in the body. The value must be passed as AMQP value.
/** * @return the float value contained in the body. The value must be passed as AMQP value. */
public float bodyAsFloat() { float ret = delegate.bodyAsFloat(); return ret; }
Returns:the double value contained in the body. The value must be passed as AMQP value.
/** * @return the double value contained in the body. The value must be passed as AMQP value. */
public double bodyAsDouble() { double ret = delegate.bodyAsDouble(); return ret; }
Returns:the character value contained in the body. The value must be passed as AMQP value.
/** * @return the character value contained in the body. The value must be passed as AMQP value. */
public char bodyAsChar() { char ret = delegate.bodyAsChar(); return ret; }
Returns:the bytes contained in the body. The value must be passed as AMQP data.
/** * @return the bytes contained in the body. The value must be passed as AMQP data. */
public io.vertx.reactivex.core.buffer.Buffer bodyAsBinary() { io.vertx.reactivex.core.buffer.Buffer ret = io.vertx.reactivex.core.buffer.Buffer.newInstance((io.vertx.core.buffer.Buffer)delegate.bodyAsBinary()); return ret; }
Returns:the string value contained in the body. The value must be passed as AMQP value.
/** * @return the string value contained in the body. The value must be passed as AMQP value. */
public String bodyAsString() { String ret = delegate.bodyAsString(); return ret; }
Returns:the symbol value contained in the body. The value must be passed as AMQP value.
/** * @return the symbol value contained in the body. The value must be passed as AMQP value. */
public String bodyAsSymbol() { String ret = delegate.bodyAsSymbol(); return ret; }
Returns:the list of values contained in the body. The value must be passed as AMQP value.
/** * @return the list of values contained in the body. The value must be passed as AMQP value. */
public <T> List<T> bodyAsList() { List<T> ret = delegate.bodyAsList(); return ret; }
Returns:the JSON object contained in the body. The value must be passed as AMQP data.
/** * @return the JSON object contained in the body. The value must be passed as AMQP data. */
public JsonObject bodyAsJsonObject() { JsonObject ret = delegate.bodyAsJsonObject(); return ret; }
Returns:the JSON array contained in the body. The value must be passed as AMQP data.
/** * @return the JSON array contained in the body. The value must be passed as AMQP data. */
public JsonArray bodyAsJsonArray() { JsonArray ret = delegate.bodyAsJsonArray(); return ret; } public String subject() { String ret = delegate.subject(); return ret; } public String contentType() { String ret = delegate.contentType(); return ret; } public String contentEncoding() { String ret = delegate.contentEncoding(); return ret; } public long expiryTime() { long ret = delegate.expiryTime(); return ret; } public long creationTime() { long ret = delegate.creationTime(); return ret; } public String groupId() { String ret = delegate.groupId(); return ret; } public String replyToGroupId() { String ret = delegate.replyToGroupId(); return ret; } public long groupSequence() { long ret = delegate.groupSequence(); return ret; }
Returns:the message properties as JSON object.
/** * @return the message properties as JSON object. */
public JsonObject applicationProperties() { JsonObject ret = delegate.applicationProperties(); return ret; }
When receiving a message, and when auto-acknowledgement is disabled, this method is used to acknowledge the incoming message. It marks the message as delivered with the accepted status.
Returns:the current AmqpMessage object
/** * When receiving a message, and when auto-acknowledgement is disabled, this method is used to acknowledge * the incoming message. It marks the message as delivered with the <code>accepted</code> status. * @return the current {@link io.vertx.reactivex.amqp.AmqpMessage} object */
public io.vertx.reactivex.amqp.AmqpMessage accepted() { delegate.accepted(); return this; }
When receiving a message, and when auto-acknowledgement is disabled, this method is used to acknowledge the incoming message as rejected.
Returns:the current AmqpMessage object
/** * When receiving a message, and when auto-acknowledgement is disabled, this method is used to acknowledge * the incoming message as <code>rejected</code>. * @return the current {@link io.vertx.reactivex.amqp.AmqpMessage} object */
public io.vertx.reactivex.amqp.AmqpMessage rejected() { delegate.rejected(); return this; }
When receiving a message, and when auto-acknowledgement is disabled, this method is used to acknowledge the incoming message as released.
Returns:the current AmqpMessage object
/** * When receiving a message, and when auto-acknowledgement is disabled, this method is used to acknowledge * the incoming message as <code>released</code>. * @return the current {@link io.vertx.reactivex.amqp.AmqpMessage} object */
public io.vertx.reactivex.amqp.AmqpMessage released() { delegate.released(); return this; }
When receiving a message, and when auto-acknowledgement is disabled, this method is used to acknowledge the incoming message as modified.
Params:
  • deliveryFailed – pass true to increase the failed delivery count
  • undeliverableHere – pass true to prevent re-delivery of this message to the same consumer
Returns:the current AmqpMessage object
/** * When receiving a message, and when auto-acknowledgement is disabled, this method is used to acknowledge * the incoming message as <code>modified</code>. * @param deliveryFailed pass <code>true</code> to increase the failed delivery count * @param undeliverableHere pass <code>true</code> to prevent re-delivery of this message to the same consumer * @return the current {@link io.vertx.reactivex.amqp.AmqpMessage} object */
public io.vertx.reactivex.amqp.AmqpMessage modified(boolean deliveryFailed, boolean undeliverableHere) { delegate.modified(deliveryFailed, undeliverableHere); return this; }
Returns:the timestamp value contained in the body. The value must be passed as AMQP value.
/** * @return the timestamp value contained in the body. The value must be passed as AMQP value. */
public java.time.Instant bodyAsTimestamp() { java.time.Instant ret = delegate.bodyAsTimestamp(); return ret; }
Returns:the UUID value contained in the body. The value must be passed as AMQP value.
/** * @return the UUID value contained in the body. The value must be passed as AMQP value. */
public java.util.UUID bodyAsUUID() { java.util.UUID ret = delegate.bodyAsUUID(); return ret; } public static AmqpMessage newInstance(io.vertx.amqp.AmqpMessage arg) { return arg != null ? new AmqpMessage(arg) : null; } }