All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.libgraviton.messaging.exception.CannotAcknowledgeMessage Maven / Gradle / Ivy

There is a newer version: 0.5.0
Show newest version
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;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy