activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiram Chirino" <hi...@hiramchirino.com>
Subject Re: ActiveMQ 4: EmbeddedBroker & Postgres persistence only
Date Mon, 24 Apr 2006 17:03:18 GMT
Try adding the connector after you configure the persistence.

On 4/22/06, Maciej Andreas Bednarz <bednarz-hannover@web.de> wrote:
>
> Hi there,
>
> I am evaluating ActiveMQ and try to embed it into my application. So far
> everything goes well. But when I try to change the persistence from derby to
> postgres this seems to have no effect. After startup postgres tables are
> created, but when I send some durable messages they are persisted in derby
> only. Could you please review my code?
>
> -- main method to start the broker --
>
> BrokerService broker = new BrokerService();
> broker.addConnector("tcp://localhost:61616");
> broker.setDeleteAllMessagesOnStartup(false);
> broker.setPersistent(true);
> broker.setPersistenceAdapter(createPersistenceAdapter());
> broker.start();
>
> -- persistence adapter creator --
>
> static PersistenceAdapter createPersistenceAdapter() throws Exception {
>
>         PGPoolingDataSource pgsDs = new PGPoolingDataSource();
>
>         pgsDs.setServerName("localhost");
>         pgsDs.setDatabaseName("activemq");
>         pgsDs.setPortNumber(0);
>         pgsDs.setUser("activemq");
>         pgsDs.setPassword("activemq");
>         pgsDs.setDataSourceName("postgres");
>         pgsDs.setInitialConnections(1);
>         pgsDs.setMaxConnections(10);
>
>         JDBCPersistenceAdapter psa = new JDBCPersistenceAdapter(pgsDs, new
> DefaultWireFormat());
>
>          ActiveMQQueue queue = new ActiveMQQueue();
>         queue.createDestination("TOOL.DEFAULT");
>         psa.createQueueMessageStore(queue);
>         psa.start();
>
>         return psa;
> }
>
> -- Info output after starting my broker --
>
> INFO - ActiveMQ 4.0-RC2 JMS Message Broker (localhost) is starting
> INFO - For help or more information please see:
> http://incubator.apache.org/activemq/
> INFO - Database driver recognized: [apache_derby_embedded_jdbc_driver]
> INFO - Journal Recovery Started from: Active Journal: using 2 x 20.0 Megs
> at: ...
> INFO - Journal Recovered: 1 message(s) in transactions recovered.
> INFO - Database driver recognized: [postgresql_native_driver]
>
> INFO - Listening for connections at: tcp://msgn2539i:61616
> INFO - Connector tcp://msgn2539i:61616 Started
> INFO - ActiveMQ JMS Message Broker (localhost) started
> INFO - JMX consoles can connect to
> service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
>
> As you can see [apache_derby_embedded_jdbc_driver] is still loaded and if I
> send some durable messages, they are persisted in derby ond not in postgres.
>
> Can someone give my an example of a working configuration for postgres as
> only data store for persistent messages?
>
>
> Thanks,
>
> Maciej A. Bednarz
>
> --
> View this message in context: http://www.nabble.com/ActiveMQ-4%3A-EmbeddedBroker-Postgres-persistence-only-t1490715.html#a4039343
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


--
Regards,
Hiram

Mime
View raw message