From an ActiveMQConnection or ActiveMQConnectionFactory set the policy
via this method

http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/ActiveMQConnection.html#setRedeliveryPolicy(org.apache.activemq.RedeliveryPolicy)

On 1/23/07, leonardinius <[EMAIL PROTECTED]> wrote:

how to progmatically set recovery policy, if i am using ConnectionFactory

Hashtable props = new Hashtable();

props.put(Context.INITIAL_CONTEXT_FACTORY,
conf.getProperty("jms.connection.factory",
"org.apache.activemq.jndi.ActiveMQInitialContextFactory"));
props.put(Context.PROVIDER_URL, conf.getProperty("jms.provider.url",
"vm:(broker:(vm://localhost)?persistent=false&useJmx=false)?marshal=false"));

javax.naming.Context ctx =  null;
try{
  ctx = new InitialContext(props);
} catch(NamingException e) {
...
}

// Create a ConnectionFactory
connectionFactory = (ActiveMQConnectionFactory)
ctx.lookup("ConnectionFactory");
connectionFactory.setClientID("xxxxxxxxx");
connection = connectionFactory.createConnection();
defaultSession = connection.createSession(true, Session.SESSION_TRANSACTED);


James.Strachan wrote:
>
> ...
> I'd recommend using <retroactive> and just implementing your own strategy
> http://incubator.apache.org/activemq/retroactive-consumer.html
> http://incubator.apache.org/activemq/subscription-recovery-policy.html
>
> and implement your own subscription recovery policy...
> 
http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/broker/region/policy/SubscriptionRecoveryPolicy.html
>
> or you could go with the idea of using a single persistent
> subscription using a wildcard. e.g. to FOO.> then all your generated
> topics begin with FOO..> such as FOO.A or FOO.A.B.C.WHATNOT
>
> The only thing is I don't think we've yet implemented retroactive for
> durable subscriptions - so the first idea is probably the easiest
> (unless you wanna patch the code to support retroactive on persistent
> topics).
> ...
>

--
View this message in context: 
http://www.nabble.com/Sending-messages-to-topic-with-no-consumers-at-all%28-with-message-TTL-set-on%29-tf3052461.html#a8517872
Sent from the ActiveMQ - User mailing list archive at Nabble.com.




--

James
-------
http://radio.weblogs.com/0112098/

Reply via email to