Atomikos Forum

ActiveMQ durable topic subscriber not working

The issue is very similar to the following discussion
default82df.html?community.6.2048.8

I am trying to setup JTA with connections from DB and JMS (activemq).

While doing this, I am getting the same error, Client ID already connected. I thought that since this is a very old issue it should have been resolved, but it seems it is not.

Caused by: javax.jms.InvalidClientIDException: Broker: localhost - Client: client-id-1 already connected from tcp://127.0.0.1:61566

I am using transactions-jta ver 3.9.3

My configuration is as follows

    @Bean(name= "transactionPolicy")
    public TransactedPolicy transactedPolicy() {
        return new SpringTransactionPolicy(platformTransactionManager());
    }

    @Bean
    public PlatformTransactionManager platformTransactionManager() {
        return new JtaTransactionManager(userTransaction(), transactionManager());
    }

    @Bean
    public UserTransaction userTransaction() {
        try {
            UserTransactionImp userTransactionImp = new UserTransactionImp();
            userTransactionImp.setTransactionTimeout(1000);
            return userTransactionImp;
        } catch (SystemException e) {
            throw new RuntimeException(e);
        }
    }

    @Bean(initMethod = "init", destroyMethod = "close")
    public TransactionManager transactionManager() {
        UserTransactionManager userTransactionManager = new UserTransactionManager();
        userTransactionManager.setForceShutdown(false);
        return userTransactionManager;
    }

    @Bean(initMethod = "init", destroyMethod = "close")
    public DataSource dataSource() throws SQLException {
        OracleXADataSource xaDataSource = new OracleXADataSource();
        xaDataSource.setURL(url);
        xaDataSource.setUser(username);
        xaDataSource.setPassword(password);
        AtomikosDataSourceBean dataSourceBean = new AtomikosDataSourceBean();
        dataSourceBean.setXaDataSource(xaDataSource);
        dataSourceBean.setXaDataSourceClassName(driverClass);
        dataSourceBean.setUniqueResourceName("xadb");
        return dataSourceBean;
    }

    @Bean(initMethod = "init", destroyMethod = "close")
    public ConnectionFactory connectionFactory() {
        AtomikosConnectionFactoryBean connectionFactoryBean = new AtomikosConnectionFactoryBean();
        connectionFactoryBean.setXaConnectionFactory(activeMQXAConnectionFactory());
        connectionFactoryBean.setMaxPoolSize(1);
        connectionFactoryBean.setUniqueResourceName("xamq");
        return  connectionFactoryBean;
    }

    private ActiveMQXAConnectionFactory activeMQXAConnectionFactory() {
        ActiveMQXAConnectionFactory activeMQXAConnectionFactory = new ActiveMQXAConnectionFactory();
        activeMQXAConnectionFactory.setBrokerURL(brokerURL);
        activeMQXAConnectionFactory.setClientID("efaktura-peppol-agreement-server-jms");
        activeMQXAConnectionFactory.setMaxThreadPoolSize(1);
        return activeMQXAConnectionFactory;

    }

I am trying to use camel jms component for receiving the message.
Varesh Tapadia Send private email
Monday, August 03, 2015
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics