io.smallrye.reactive.messaging.amqp.fault.AmqpModifiedFailed Maven / Gradle / Ivy
package io.smallrye.reactive.messaging.amqp.fault;
import static io.smallrye.reactive.messaging.amqp.i18n.AMQPLogging.log;
import java.util.concurrent.CompletionStage;
import io.smallrye.reactive.messaging.amqp.AmqpMessage;
import io.smallrye.reactive.messaging.amqp.ConnectionHolder;
import io.vertx.mutiny.core.Context;
/**
* This nack strategy marking the message as {@code modified} and set the {@code delivery-failed} attribute to {@code true}.
*
* The message might be redelivered on the same node.
*
* See http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-modified.
*/
public class AmqpModifiedFailed implements AmqpFailureHandler {
private final String channel;
public AmqpModifiedFailed(String channel) {
this.channel = channel;
}
@Override
public CompletionStage handle(AmqpMessage msg, Context context, Throwable reason) {
log.nackedModifiedFailedMessage(channel);
log.fullIgnoredFailure(reason);
return ConnectionHolder.runOnContext(context, msg, m -> m.modified(true, false));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy