package com.agilex.healthcare.schedulingmanager.notification.appointmentrequest;

import com.agilex.messaging.provider.beanstalk.Queue;
import com.agilex.messaging.provider.beanstalk.config.BeanstalkBusConfiguration;

/**
 * Created with IntelliJ IDEA.
 * User: clarkee
 * Date: 2/27/13
 * Time: 11:52 AM
 * To change this template use File | Settings | File Templates.
 */
public class HaMessagingConfiguration extends BeanstalkBusConfiguration {
    
    private final boolean enabled;
    private String queueName;

    public HaMessagingConfiguration(String host, int port, boolean enabled, String queueName, int priority,
            int delaySecond, int processExpirationSecond, int maxRetries, int retryDelaySecond,
            Integer replyTimeoutSecond) {
        super(host, port);
        this.enabled = enabled;
        this.setQueueName(queueName);
        this.addQueueConfiguration(Queue.createDestination(queueName), priority, delaySecond, processExpirationSecond,
                maxRetries, retryDelaySecond, replyTimeoutSecond);
    }
    public HaMessagingConfiguration(String host, int port) {
        super(host, port);
        this.enabled = true;
    }

    protected void addQueueConfig(String queueName, int priority,
            int delaySecond, int processExpirationSecond, int maxRetries, int retryDelaySecond,
            Integer replyTimeoutSecond) {

        super.addQueueConfiguration(Queue.createDestination(queueName), priority, delaySecond, processExpirationSecond,
                maxRetries, retryDelaySecond, replyTimeoutSecond);
    }
    
    public boolean isEnabled() {
        return enabled;
    }

    public String getQueueName() {
        return queueName;
    }

    protected void setQueueName(String queueName) {
        this.queueName = queueName;
    }
}
