package lc.esp.sdk;

import lc.mecha.log.MechaLogger;
import lc.mecha.log.MechaLoggerFactory;
import lc.mecha.util.UniversalJob;
import org.apache.activemq.ActiveMQConnectionFactory;

/**
 * Enhanced Services Platform mk17 client.
 * <p>
 * This implementation is essentially a wrapper around the ActiveMQ JMS client. We are not adding much functionality
 * here other than some protocol semantics which are peculiar to ESP and ensuring that the right dependencies
 * are brought into the enduser's project.
 * <p>
 * In the future the client will also handle discovery and authentication. Note that authentication with ESP is
 * peculiar, so the regular username/password available via normal JMS will not work.
 *
 * @author Alex Leigh
 * @since mk17 (GIPSY DANGER)
 */
public class ESPClient {
    private static final MechaLogger logger = MechaLoggerFactory.getLogger(ESPClient.class);
    private final ActiveMQConnectionFactory connectionFactory;

    public ESPClient() {
        UniversalJob.banner(logger, "Enhanced Services Platform/CLIENT mk18 (GIPSY DANGER)");
        connectionFactory = new ActiveMQConnectionFactory("failover://(tcp://esp1.leigh-co.com:52018)");
        connectionFactory.setUseAsyncSend(true);
    }

    /**
     * Return the connection factory associated with this client.
     */
    public ActiveMQConnectionFactory getConnectionFactory() {
        return connectionFactory;
    }
}