You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Raffaele <r....@prismasw.it> on 2007/06/11 12:11:09 UTC

setDeleteAllMessagesOnStartup(true) and MySql

Hi all,

Im yet trying to do some test with a BrokerService and some settings.

Now, I tried with persistence on MySql and with
setDeleteAllMessagesOnStartup(true), here is the code:

...
configurePersistence();
m_broker.addConnector("tcp://localhost:61616");
m_broker.setDeleteAllMessagesOnStartup(true);
m_broker.start();
// Do sending of messagges
....

And so, with that flag set to true, the program blocks indefinitely in
m_broker.start(), in particular it blocks here(the bold line of code) in
JDBCPersitenceAdapter.java:
public void deleteAllMessages() throws IOException {
        TransactionContext c = getTransactionContext();
        try {
            getAdapter().doDropTables(c);
           
getAdapter().setUseExternalMessageReferences(isUseExternalMessageReferences());
            getAdapter().doCreateTables(c);
        } catch (SQLException e) {
            JDBCPersistenceAdapter.log("JDBC Failure: ",e);
            throw IOExceptionSupport.create(e);
        } finally {
            c.close();
        }
    }

Any hint?

Best regards,

Raffaele
-- 
View this message in context: http://www.nabble.com/setDeleteAllMessagesOnStartup%28true%29-and-MySql-tf3900695s2354.html#a11058012
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: setDeleteAllMessagesOnStartup(true) and MySql

Posted by Tom Samplonius <to...@samplonius.org>.
----- "Raffaele" <r....@prismasw.it> wrote:

...
> To accomplish this can I use setDeleteAllMessagesOnStartup(true) on
> startup
> or have I to use specific SQL delete statement on activemq DB?
...

  You should look into the URI configuration.  You can set certain Xbean config options on the command line.  You just need to include the "deleteAllMessagesOnStartup="true"" attribute in the broker tag.

  XBean reference:

http://activemq.apache.org/xbean-xml-reference-41.html

  So on the command line, just add the "...?deleteAllMessagesOnStartup=true" to the command-line.

  See:

http://activemq.apache.org/activemq-command-line-tools-reference.html


It seems odd, that you can use a config file, and then use the URI config method to over-ride some attributes.  Or maybe you can?

Tom

Re: setDeleteAllMessagesOnStartup(true) and MySql

Posted by Raffaele <r....@prismasw.it>.
First of all, they are only test for evaluating ActiveMQ to decide if using
it in a very important Italian (but also sold in France and afterwards
perhaps in some parts of USA) project.
Then, if I'm in front of an API I search to detect all possible leaks, if
they are, before confirm to my boss that a product is a valid product to
became part of an important project.

The API permits me to do something, well, I do that "something", if it
generates an error, it is a bug. This is my point of view.

If I used NO PERSITENCE I would not have the need of
setDeleteAllMessagesOnStartup(true).
You are claiming that deleting messages on startup using PERSITENCE sounds
like using NO PERSITENCE.
Then I ask you, why your API permits me, the user, to delete messages on
startup if with either persistence true either persitence false that method
doesn't nothing of useful?

However, there could be some cases when, using persistence, and using
embedded brokers, I would like to decide if starting a broker in a "pure"
and empty database, where I would be sure that the db is empty and if it
isn't I would delete all records.
To accomplish this can I use setDeleteAllMessagesOnStartup(true) on startup
or have I to use specific SQL delete statement on activemq DB?

Thanks and best regards.

Raffaele


James.Strachan wrote:
> 
> Just out of interest, why would you want to use persistence with
> MySQL, then delete messages on startup? Sounds like you'd be better
> using non-persistence.
> 
> On 6/11/07, Raffaele <r....@prismasw.it> wrote:
>>
>> Hi all,
>>
>> Im yet trying to do some test with a BrokerService and some settings.
>>
>> Now, I tried with persistence on MySql and with
>> setDeleteAllMessagesOnStartup(true), here is the code:
>>
>> ...
>> configurePersistence();
>> m_broker.addConnector("tcp://localhost:61616");
>> m_broker.setDeleteAllMessagesOnStartup(true);
>> m_broker.start();
>> // Do sending of messagges
>> ....
>>
>> And so, with that flag set to true, the program blocks indefinitely in
>> m_broker.start(), in particular it blocks here(the bold line of code) in
>> JDBCPersitenceAdapter.java:
>> public void deleteAllMessages() throws IOException {
>>         TransactionContext c = getTransactionContext();
>>         try {
>>             getAdapter().doDropTables(c);
>>
>> getAdapter().setUseExternalMessageReferences(isUseExternalMessageReferences());
>>             getAdapter().doCreateTables(c);
>>         } catch (SQLException e) {
>>             JDBCPersistenceAdapter.log("JDBC Failure: ",e);
>>             throw IOExceptionSupport.create(e);
>>         } finally {
>>             c.close();
>>         }
>>     }
>>
>> Any hint?
>>
>> Best regards,
>>
>> Raffaele
>> --
>> View this message in context:
>> http://www.nabble.com/setDeleteAllMessagesOnStartup%28true%29-and-MySql-tf3900695s2354.html#a11058012
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/setDeleteAllMessagesOnStartup%28true%29-and-MySql-tf3900695s2354.html#a11059029
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: setDeleteAllMessagesOnStartup(true) and MySql

Posted by James Strachan <ja...@gmail.com>.
Just out of interest, why would you want to use persistence with
MySQL, then delete messages on startup? Sounds like you'd be better
using non-persistence.

On 6/11/07, Raffaele <r....@prismasw.it> wrote:
>
> Hi all,
>
> Im yet trying to do some test with a BrokerService and some settings.
>
> Now, I tried with persistence on MySql and with
> setDeleteAllMessagesOnStartup(true), here is the code:
>
> ...
> configurePersistence();
> m_broker.addConnector("tcp://localhost:61616");
> m_broker.setDeleteAllMessagesOnStartup(true);
> m_broker.start();
> // Do sending of messagges
> ....
>
> And so, with that flag set to true, the program blocks indefinitely in
> m_broker.start(), in particular it blocks here(the bold line of code) in
> JDBCPersitenceAdapter.java:
> public void deleteAllMessages() throws IOException {
>         TransactionContext c = getTransactionContext();
>         try {
>             getAdapter().doDropTables(c);
>
> getAdapter().setUseExternalMessageReferences(isUseExternalMessageReferences());
>             getAdapter().doCreateTables(c);
>         } catch (SQLException e) {
>             JDBCPersistenceAdapter.log("JDBC Failure: ",e);
>             throw IOExceptionSupport.create(e);
>         } finally {
>             c.close();
>         }
>     }
>
> Any hint?
>
> Best regards,
>
> Raffaele
> --
> View this message in context: http://www.nabble.com/setDeleteAllMessagesOnStartup%28true%29-and-MySql-tf3900695s2354.html#a11058012
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
James
-------
http://macstrac.blogspot.com/