[jboss-user] [JBoss Messaging] - Re: Scheduled messages not delayed
Thanks a lot Tim. Joel View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059025#4059025 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059025 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Messaging] - Re: Scheduled messages not delayed
When I send a jms schedule message (without consumer), it doesn't appear in jboss jmx-console scheduleMessageCount. But if I restart jboss server, this message appear correctly in jboss jmx-console scheduleMessageCount and I don't consume this. The junit test : | | import java.util.Date; | import java.util.Hashtable; | | import javax.jms.Queue; | import javax.jms.QueueConnection; | import javax.jms.QueueConnectionFactory; | import javax.jms.QueueSender; | import javax.jms.QueueSession; | import javax.jms.Session; | import javax.jms.TextMessage; | import javax.naming.Context; | import javax.naming.InitialContext; | | import junit.framework.TestCase; | | public class APITest extends TestCase { | | private QueueConnectionFactory qcf; | private QueueConnection qc = null; | private QueueSession session = null; | private QueueSender qs = null; | private Queue queue; | | | public APITest() { | super("APITest"); | } | | | protected void setUp() throws Exception { | super.setUp(); | Hashtable properties = new Hashtable(); | properties.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); | properties.put(InitialContext.PROVIDER_URL, "localhost:1100"); | Context jndiContext = new InitialContext(properties); | qcf = (QueueConnectionFactory) jndiContext.lookup("ClusteredConnectionFactory"); | | | queue = (Queue) jndiContext.lookup("queue/pcsapiMsgOutDefault"); | | qc = qcf.createQueueConnection(); | session = qc.createQueueSession(true, Session.CLIENT_ACKNOWLEDGE); | qs = session.createSender(queue); | | | } | | protected void tearDown() throws Exception { | | super.tearDown(); | if (qs != null) { | try { | qs.close(); | session.close(); | qc.close(); | queue = null; | qcf = null; | } catch (Exception e) { | System.err.println(""+e); | } | } | | } | |public void test() throws Exception |{ |try { |TextMessage messageOut; |messageOut = session.createTextMessage(); | |messageOut.setText("My message"); |messageOut.setJMSType(String.class.getName()); |try { |long dateSchedule = (new Date()).getTime()+1000*3600*2; |messageOut.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", dateSchedule); |} catch (Exception e) { |System.err.println("Problem with Schedule Property "+e); |} |messageOut.setLongProperty("JMS_JBOSS_REDELIVERY_DELAY", 1); |messageOut.setIntProperty("JMS_JBOSS_REDELIVERY_LIMIT", 3); | |qs.send(messageOut); | |session.commit(); | |} catch (Exception e) { | System.err.println(getClass().getName()+" unable to send message on queue."+e); |} | |} | | } | | Queue Configuration : | | jboss.messaging:service=ServerPeer | jboss.messaging:service=PostOffice | true | | The consumer is a mdb. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=408#408 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=408 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Messaging] - Re: Scheduled messages not delayed
Indeed, I have look the unit test org.jboss.test.messaging.jms.ScheduledDeliveryTest. my code : | @Stateless | @Clustered(partition="MyPartition") | @RemoteBinding(jndiBinding="JMSManagerBean/remote") | @TransactionManagement(value=TransactionManagementType.BEAN) | public class JMSManagerBean implements JMSManager { | |private static final long serialVersionUID = 1L; | |private static Logger log = Logger.getLogger(JMSManagerBean.class); | |private QueueConnectionFactory qcf; |private QueueConnection qc = null; |private QueueSession session = null; |private QueueSender qs = null; |private Queue queue; | |private int connect() { | String nomFileOut = "queue/myQueue"; | | Hashtable properties = new Hashtable(); | properties.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); | properties.put(InitialContext.PROVIDER_URL, "localhost:"+HAJNDI_PORT.intValue()); | Context ictx = new InitialContext(properties); | | qcf = (QueueConnectionFactory) ictx.lookup("ClusteredConnectionFactory"); | log.debug("Queue Out Name : " + nomFileOut); | | queue = (Queue) ictx.lookup(nomFileOut); | | qc = qcf.createQueueConnection(); | session = qc.createQueueSession(true, Session.CLIENT_ACKNOWLEDGE); | qs = session.createSender(queue); | | return 0; | } | | | public int sendMessage() { | try { | connect(); | TextMessage messageOut; | messageOut = session.createTextMessage(); | | messageOut.setText("My message"); | messageOut.setJMSType(String.class.getName()); | try { | long dateSchedule = current.getDeliveryDate().getTime(); | log.debug("*** dateSchedule : " + dateSchedule); | messageOut.setLongProperty(JBossMessage.JMS_JBOSS_SCHEDULED_DELIVERY_PROP_NAME, dateSchedule); | } catch (Exception e) { | log.error("Problem with Schedule Property ",e); | } | messageOut.setLongProperty("JMS_JBOSS_REDELIVERY_DELAY", 1); | messageOut.setIntProperty("JMS_JBOSS_REDELIVERY_LIMIT", 3); | | qs.send(messageOut); | | log.debug("SYSTEM.CURRENTTIMEMILLIS : " + System.currentTimeMillis()); | session.commit(); | | } catch (Exception e) { | log.error(getClass().getName()+" unable to send message on queue.",e); | retour = ErrorManager.CAN_NOT_SEND_MT; | } finally { | disconnect(); | } | return 0; | } | | | private int disconnect() { | if (qs != null) { | try { | qs.close(); | session.close(); | qc.close(); | queue = null; | qcf = null; | } catch (Exception e) { | log.error("",e); | logNetcool.error("KO"); | } | } | return 0; | } | } | | Also, I tried with the AUTO_ACKNOWLEDGE mode, but the result is the same. Thanks, joel View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055530#4055530 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055530 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Messaging] - Scheduled messages not delayed
Hi, I use jboss messaging 1.3.0 integrated in jboss 4.2.0, with clustered queue, and oracle persistent database. I follow the automated clustered installation of jboss messaging. I want to schedule jms messages. When I send jms message with JMS_JBOSS_SCHEDULED_DELIVERY property, messages are consumed as soon as are produced. The SCHED_DELIVERY column value in database seems correct. Is there a specific configuration to allow this fonctionnality ? Best Regards, Joel View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055518#4055518 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055518 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user