All, I'm looking to embed ActiveMQ 5.8 in my Java based server and I wanted to confirm my thinking to make sure I was taking the right approach.
My desire is to have a VM accessible queue (not accessible via a network) that is using a relational database (SQL Server 2012 in this instance). The server can have multiple instances, all pointed to the same DB for persistence. Each server will host a broker and will have a message listener, all sharing the same queue. When I push a message into the queue on one server, I want it accessible by either server (whichever picks it up first). My plan is to initialize the broker in each server with a JDBCPersistanceAdapter using the following code: org.apache.commons.dbcp.BasicDataSource ds = new org.apache.commons.dbcp.BasicDataSource(); ds.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); ds.setUrl("jdbc:sqlserver://dbhost:1433;databaseName=activemq"); ds.setUsername("user"); ds.setPassword("password"); ds.setMaxActive(10); JDBCPersistenceAdapter jdbcpa = new JDBCPersistenceAdapter(); jdbcpa.setDirectory(new File("activemq")); jdbcpa.setDataSource(ds); final BrokerService broker = new BrokerService(); broker.setBrokerName("testing"); broker.setPersistenceAdapter(jdbcpa); new Thread() { @Override public void run() { try { broker.start(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }.start(); So I would have multiple embedded servers connecting to the same db and the same queue. Am I on the right track or totally off? Thanks Marc