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

com.github.lontime.extredisson.service.CallbackContext Maven / Gradle / Ivy

The newest version!
package com.github.lontime.extredisson.service;

import java.util.Collections;
import java.util.List;

import com.github.lontime.base.serial.model.Message;
import com.github.lontime.extredisson.common.MessageWithId;

/**
 * CallbackContext.
 * @author lontime
 * @since 1.0
 */
public class CallbackContext {

    private final Integer retryNo;

    private List messages;

    public CallbackContext(String msgId, Integer retryNo, Message message) {
        this(retryNo, Collections.singletonList(new MessageWithId(msgId, message)));
    }

    public CallbackContext(Integer retryNo, List messages) {
        this.retryNo = retryNo;
        this.messages = messages;
    }

    public Integer getRetryNo() {
        return retryNo;
    }

    public List getMessages() {
        return messages;
    }

    public static CallbackContext create(String msgId, Message message) {
        return new CallbackContext(msgId, 0, message);
    }

    public static CallbackContext create(List messages) {
        return new CallbackContext(0, messages);
    }

    public static CallbackContext create(Integer retry, List messages) {
        return new CallbackContext(retry, messages);
    }

    public static CallbackContext create(String msgId, Integer retry, Message message) {
        return new CallbackContext(msgId, retry, message);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy