com.github.libgraviton.messaging.exception.CannotAcknowledgeMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of messaging Show documentation
Show all versions of messaging Show documentation
A library to simplify the use of message brokers.
package com.github.libgraviton.messaging.exception;
import com.github.libgraviton.messaging.MessageAcknowledger;
import java.io.IOException;
public class CannotAcknowledgeMessage extends IOException {
private MessageAcknowledger acknowledger;
private String messageId;
public CannotAcknowledgeMessage(MessageAcknowledger acknowledger, String messageId, String reason) {
this(acknowledger, messageId, reason, null);
}
public CannotAcknowledgeMessage(MessageAcknowledger acknowledger, String messageId, Exception cause) {
this(acknowledger, messageId, "An com.github.libgraviton.messaging.exception occurred", cause);
}
private CannotAcknowledgeMessage(
MessageAcknowledger acknowledger,
String messageId,
String reason,
Exception cause
) {
super(
String.format(
"Acknowledger '%s' is unable to acknowledge message with id '%s'. Reason: '%s'.",
acknowledger,
messageId,
reason
),
cause
);
this.acknowledger = acknowledger;
this.messageId = messageId;
}
public MessageAcknowledger getAcknowledger() {
return acknowledger;
}
public String getMessageId() {
return messageId;
}
}