You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by ABHATNAGAR <bh...@hotmail.com> on 2008/12/23 04:34:35 UTC

Unable to setup : Default Persistence in ActiveMQ

This is how my activemq.xml looks like:
=========================================================
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
   
    http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
        <!-- START SNIPPET: xbean -->
<beans>


  <broker brokerName="broker" useJmx="true" persistent="true"
xmlns="http://activemq.apache.org/schema/core">

    <!-- In ActiveMQ 4, you can setup destination policies -->
    <destinationPolicy>
      <policyMap>
        <policyEntries>

          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy/>
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy/>
            </subscriptionRecoveryPolicy>
          </policyEntry>

        </policyEntries>
      </policyMap>
    </destinationPolicy>

   
     
    <transportConnectors>
      <transportConnector name="openwire" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
      <transportConnector name="stomp" uri="stomp://localhost:61613"/>
      <transportConnector name="xmpp" uri="xmpp://localhost:61222"/>
    </transportConnectors>
    
 	<persistenceAdapter>
    	<amqPersistenceAdapter directory="activemq-data" maxFileLength="32mb"/>
    </persistenceAdapter>
    
    <networkConnectors>
      <!-- by default just auto discover the other brokers -->
      <networkConnector name="defaultNetwork" uri="multicast://default"/>
      <!--
      <networkConnector name="host1 and host2"
uri="static://(tcp://host1:61616,tcp://host2:61616)" failover="true"/>
      -->
    </networkConnectors>

  </broker>

  <!-- lets create a command agent to respond to admin commands over JMS or
XMPP on the ActiveMQ.Agent topic -->
  <commandAgent xmlns="http://activemq.apache.org/schema/core"/>

</beans>
       
=====================================================================


My Messages are not getting saved : when my BROKER goes down.


Please help --- Ankit
-- 
View this message in context: http://www.nabble.com/Unable-to-setup-%3A--Default-Persistence-in-ActiveMQ-tp21139023p21139023.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Re: Unable to setup : Default Persistence in ActiveMQ

Posted by Dejan Bosanac <de...@nighttale.net>.
I just tried your configuration and everything works fine. Start a broker,
send a message, close the broker, start it again and then consume the
message.


Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Wed, Dec 24, 2008 at 3:26 PM, ABHATNAGAR <bh...@hotmail.com>wrote:

>
> This is how my activemq.xml looks like:
> =========================================================
> <!--
>    Licensed to the Apache Software Foundation (ASF) under one or more
>    contributor license agreements.  See the NOTICE file distributed with
>    this work for additional information regarding copyright ownership.
>    The ASF licenses this file to You under the Apache License, Version 2.0
>    (the "License"); you may not use this file except in compliance with
>    the License.  You may obtain a copy of the License at
>
>    http://www.apache.org/licenses/LICENSE-2.0
>
>    Unless required by applicable law or agreed to in writing, software
>    distributed under the License is distributed on an "AS IS" BASIS,
>    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>    See the License for the specific language governing permissions and
>    limitations under the License.
> -->
>        <!-- START SNIPPET: xbean -->
> <beans>
>
>
>  <broker brokerName="broker" useJmx="true" persistent="true"
> xmlns="http://activemq.apache.org/schema/core">
>
>    <!-- In ActiveMQ 4, you can setup destination policies -->
>    <destinationPolicy>
>      <policyMap>
>        <policyEntries>
>
>          <policyEntry topic="FOO.>">
>            <dispatchPolicy>
>              <strictOrderDispatchPolicy/>
>            </dispatchPolicy>
>            <subscriptionRecoveryPolicy>
>              <lastImageSubscriptionRecoveryPolicy/>
>            </subscriptionRecoveryPolicy>
>          </policyEntry>
>
>        </policyEntries>
>      </policyMap>
>    </destinationPolicy>
>
>
>
>    <transportConnectors>
>      <transportConnector name="openwire" uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
>      <transportConnector name="stomp" uri="stomp://localhost:61613"/>
>      <transportConnector name="xmpp" uri="xmpp://localhost:61222"/>
>    </transportConnectors>
>
>  <persistenceAdapter>
>    <amqPersistenceAdapter directory="activemq-data" maxFileLength="32mb"/>
>    </persistenceAdapter>
>
>    <networkConnectors>
>      <!-- by default just auto discover the other brokers -->
>      <networkConnector name="defaultNetwork" uri="multicast://default"/>
>      <!--
>      <networkConnector name="host1 and host2"
> uri="static://(tcp://host1:61616,tcp://host2:61616)" failover="true"/>
>      -->
>    </networkConnectors>
>
>  </broker>
>
>  <!-- lets create a command agent to respond to admin commands over JMS or
> XMPP on the ActiveMQ.Agent topic -->
>  <commandAgent xmlns="http://activemq.apache.org/schema/core"/>
>
> </beans>
>
>
> I am using ActiveMQ 5.2.
>
> My use case is I need to persist the message by using the default
> PERSISTENCE.
> Also I have the DELIVERY MODE AS PERSISTENT
>
>
> Ankit
> --
> View this message in context:
> http://www.nabble.com/Unable-to-setup-%3A--Default-Persistence-in-ActiveMQ-tp21139023p21156858.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>
>

Re: Unable to setup : Default Persistence in ActiveMQ

Posted by ABHATNAGAR <bh...@hotmail.com>.
This is how my activemq.xml looks like:
=========================================================
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
   
    http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
        <!-- START SNIPPET: xbean -->
<beans>


  <broker brokerName="broker" useJmx="true" persistent="true"
xmlns="http://activemq.apache.org/schema/core">

    <!-- In ActiveMQ 4, you can setup destination policies -->
    <destinationPolicy>
      <policyMap>
        <policyEntries>

          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy/>
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy/>
            </subscriptionRecoveryPolicy>
          </policyEntry>

        </policyEntries>
      </policyMap>
    </destinationPolicy>

   
     
    <transportConnectors>
      <transportConnector name="openwire" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
      <transportConnector name="stomp" uri="stomp://localhost:61613"/>
      <transportConnector name="xmpp" uri="xmpp://localhost:61222"/>
    </transportConnectors>
   
  <persistenceAdapter>
    <amqPersistenceAdapter directory="activemq-data" maxFileLength="32mb"/>
    </persistenceAdapter>
   
    <networkConnectors>
      <!-- by default just auto discover the other brokers -->
      <networkConnector name="defaultNetwork" uri="multicast://default"/>
      <!--
      <networkConnector name="host1 and host2"
uri="static://(tcp://host1:61616,tcp://host2:61616)" failover="true"/>
      -->
    </networkConnectors>

  </broker>

  <!-- lets create a command agent to respond to admin commands over JMS or
XMPP on the ActiveMQ.Agent topic -->
  <commandAgent xmlns="http://activemq.apache.org/schema/core"/>

</beans> 


I am using ActiveMQ 5.2.

My use case is I need to persist the message by using the default
PERSISTENCE.
Also I have the DELIVERY MODE AS PERSISTENT


Ankit
-- 
View this message in context: http://www.nabble.com/Unable-to-setup-%3A--Default-Persistence-in-ActiveMQ-tp21139023p21156858.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Re: Unable to setup : Default Persistence in ActiveMQ

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Ankit,

can you give us some more details, like:

- what version of amq are you using?
- how does you configuration file looks like?
- what is your use case scenario?

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Tue, Dec 23, 2008 at 3:11 PM, ABHATNAGAR <bh...@hotmail.com>wrote:

>
> Hey Guys,
> I have already set the Delivery mode as PERSISTENT, but that was also not
> working.
>
> Please let me know if I need to do some other setting.
> I dont want to use any custom implementation for persistence, i just want
> to
> use the DEFAULT AMQ persistence.
>
> Ankit
> --
> View this message in context:
> http://www.nabble.com/Unable-to-setup-%3A--Default-Persistence-in-ActiveMQ-tp21139023p21145144.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>
>

Re: Unable to setup : Default Persistence in ActiveMQ

Posted by ABHATNAGAR <bh...@hotmail.com>.
Hey Guys,
I have already set the Delivery mode as PERSISTENT, but that was also not
working.

Please let me know if I need to do some other setting.
I dont want to use any custom implementation for persistence, i just want to
use the DEFAULT AMQ persistence.

Ankit
-- 
View this message in context: http://www.nabble.com/Unable-to-setup-%3A--Default-Persistence-in-ActiveMQ-tp21139023p21145144.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Re: Unable to setup : Default Persistence in ActiveMQ

Posted by Bruce Snyder <br...@gmail.com>.
On Tue, Dec 23, 2008 at 2:37 AM, James Strachan
<ja...@gmail.com> wrote:
> 2008/12/23 Bruce Snyder <br...@gmail.com>:
>> On Mon, Dec 22, 2008 at 8:34 PM, ABHATNAGAR <bh...@hotmail.com> wrote:
>>
>>> My Messages are not getting saved : when my BROKER goes down.
>>
>> Are you sending persistent messages? By default messages are
>> non-persistent. If you want messages to be persistent you must
>> explicitly enable this functionality via either the
>> Message.setJMSDeliveryMode() method or the
>> MessageProducer.setDeliveryMode() method. See the JMS API for more
>> information:
>
> Wrong way around - messages are persistent by default

Whoops - I'm thinking of the ActiveMQ examples. My mistake.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/

Re: Unable to setup : Default Persistence in ActiveMQ

Posted by James Strachan <ja...@gmail.com>.
2008/12/23 Bruce Snyder <br...@gmail.com>:
> On Mon, Dec 22, 2008 at 8:34 PM, ABHATNAGAR <bh...@hotmail.com> wrote:
>
>> My Messages are not getting saved : when my BROKER goes down.
>
> Are you sending persistent messages? By default messages are
> non-persistent. If you want messages to be persistent you must
> explicitly enable this functionality via either the
> Message.setJMSDeliveryMode() method or the
> MessageProducer.setDeliveryMode() method. See the JMS API for more
> information:

Wrong way around - messages are persistent by default

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

Open Source Integration
http://fusesource.com/

Re: Unable to setup : Default Persistence in ActiveMQ

Posted by Bruce Snyder <br...@gmail.com>.
On Mon, Dec 22, 2008 at 8:34 PM, ABHATNAGAR <bh...@hotmail.com> wrote:

> My Messages are not getting saved : when my BROKER goes down.

Are you sending persistent messages? By default messages are
non-persistent. If you want messages to be persistent you must
explicitly enable this functionality via either the
Message.setJMSDeliveryMode() method or the
MessageProducer.setDeliveryMode() method. See the JMS API for more
information:

http://java.sun.com/javaee/5/docs/api/javax/jms/Message.html#getJMSDeliveryMode()
http://java.sun.com/javaee/5/docs/api/javax/jms/MessageProducer.html#setDeliveryMode(int)

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/