Search in sources :

Example 1 with DataConnectException

use of io.openmessaging.connector.api.exception.DataConnectException in project rocketmq-externals by apache.

the class RabbitMQPatternProcessor method connectionFactory.

public ConnectionFactory connectionFactory() {
    RMQConnectionFactory connectionFactory = new RMQConnectionFactory();
    try {
        List<String> urlList = new ArrayList<>();
        urlList.add(config.getBrokerUrl());
        connectionFactory.setUris(urlList);
    } catch (JMSException e) {
        throw new DataConnectException(ErrorCode.START_ERROR_CODE, e.getMessage(), e);
    }
    return connectionFactory;
}
Also used : DataConnectException(io.openmessaging.connector.api.exception.DataConnectException) ArrayList(java.util.ArrayList) JMSException(javax.jms.JMSException) RMQConnectionFactory(com.rabbitmq.jms.admin.RMQConnectionFactory)

Example 2 with DataConnectException

use of io.openmessaging.connector.api.exception.DataConnectException in project rocketmq-externals by apache.

the class BaseJmsSourceTask method start.

@Override
public void start(KeyValue props) {
    try {
        this.config = new Config();
        this.config.load(props);
        this.sourcePartition = ByteBuffer.wrap(config.getBrokerUrl().getBytes("UTF-8"));
        this.replicator.start();
    } catch (Exception e) {
        log.error("activemq task start failed.", e);
        throw new DataConnectException(ErrorCode.START_ERROR_CODE, e.getMessage(), e);
    }
}
Also used : DataConnectException(io.openmessaging.connector.api.exception.DataConnectException) Config(org.apache.rocketmq.connect.jms.Config) JMSException(javax.jms.JMSException) DataConnectException(io.openmessaging.connector.api.exception.DataConnectException)

Example 3 with DataConnectException

use of io.openmessaging.connector.api.exception.DataConnectException in project rocketmq-externals by apache.

the class ActivemqSourceTask method start.

@Override
public void start(KeyValue props) {
    try {
        this.config = new Config();
        this.config.load(props);
        this.sourcePartition = ByteBuffer.wrap(config.getActivemqUrl().getBytes("UTF-8"));
        this.replicator = new Replicator(config);
        this.replicator.start();
    } catch (Exception e) {
        log.error("activemq task start failed.", e);
        throw new DataConnectException(ErrorCode.START_ERROR_CODE, e.getMessage(), e);
    }
}
Also used : DataConnectException(io.openmessaging.connector.api.exception.DataConnectException) Config(org.apache.rocketmq.connect.activemq.Config) Replicator(org.apache.rocketmq.connect.activemq.Replicator) JMSException(javax.jms.JMSException) DataConnectException(io.openmessaging.connector.api.exception.DataConnectException)

Aggregations

DataConnectException (io.openmessaging.connector.api.exception.DataConnectException)3 JMSException (javax.jms.JMSException)3 RMQConnectionFactory (com.rabbitmq.jms.admin.RMQConnectionFactory)1 ArrayList (java.util.ArrayList)1 Config (org.apache.rocketmq.connect.activemq.Config)1 Replicator (org.apache.rocketmq.connect.activemq.Replicator)1 Config (org.apache.rocketmq.connect.jms.Config)1