Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0F3791047A for ; Tue, 4 Mar 2014 07:09:36 +0000 (UTC) Received: (qmail 96401 invoked by uid 500); 4 Mar 2014 07:09:35 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 96060 invoked by uid 500); 4 Mar 2014 07:09:32 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 95975 invoked by uid 99); 4 Mar 2014 07:09:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Mar 2014 07:09:29 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of noel.oconnor@gmail.com designates 209.85.216.179 as permitted sender) Received: from [209.85.216.179] (HELO mail-qc0-f179.google.com) (209.85.216.179) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Mar 2014 07:09:24 +0000 Received: by mail-qc0-f179.google.com with SMTP id m20so4567546qcx.24 for ; Mon, 03 Mar 2014 23:09:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=P4DuVEVNcwXZ5IL6MZHoALdQJmcopCW+7WGxg4wToCQ=; b=EFCrr3ZNKt8kR1Juhs2Ng0yPt9yZ486cQiQi1RSSe+OFIeM0NDUfRO6kdjKqfHtjK0 jO0dq3q8ZEIe8WBXNjDo4POoOA0CdXvDQQXmxYzVOkGFZV/8JQVZUkh2KZMZcNua1paQ wFJy0zQDDibI4S8LWAMfOPyalElxI+Z+2RMwmLKTT4AgOW5XPOwCXdDBC45/CMw9hkto zyLaMeXtnS5jNV8LLVc4nUZL8TNUlZYJYCbx93Ef+qnuPRyZTdU4V9FEoCqxT4dVPmeb 4vuGQn/ptBhp/eAaQBvOvDgWUKTTNRQ7qacNNrTbGPb6OrzKBgkYkSAth9kS3oZJlE6v LQVQ== X-Received: by 10.224.8.70 with SMTP id g6mr29018247qag.45.1393916943247; Mon, 03 Mar 2014 23:09:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.185.66 with HTTP; Mon, 3 Mar 2014 23:08:43 -0800 (PST) In-Reply-To: References: From: Noel OConnor Date: Tue, 4 Mar 2014 18:08:43 +1100 Message-ID: Subject: Re: can I enable queue priority by plain java code To: users@activemq.apache.org Content-Type: multipart/alternative; boundary=001a11c29ca03faf0a04f3c294b0 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c29ca03faf0a04f3c294b0 Content-Type: text/plain; charset=ISO-8859-1 http://docs.oracle.com/javaee/5/api/javax/jms/MessageProducer.html#setPriority(int) On Tue, Mar 4, 2014 at 11:57 AM, Li Li wrote: > I am using the following code snippet to send messages to a queue. How > to make priority queue enabled? > class Producer{ > private ActiveMQConnection conn; > private QueueSender sender; > private QueueSession session; > public Producer() throws JMSException{ > ActiveMQConnectionFactory connectionFactory = new > ActiveMQConnectionFactory( > "tcp://localhost:61616"); > conn = (ActiveMQConnection) connectionFactory.createConnection(); > conn.start(); > session = conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); > > Queue queue = session.createQueue("TEST.QUEUE"); > > sender = session.createSender(queue); > sender.setDeliveryMode(DeliveryMode.PERSISTENT); > } > public void sendMsgs(int max) throws JMSException{ > //sender.setTimeToLive(10000); > for(int i=0;i Message msg=session.createTextMessage("msg"+i); > sender.send(msg); > } > } > public void close(){ > if(this.session!=null){ > try { > session.close(); > } catch (JMSException e) { > e.printStackTrace(); > } > } > if(this.conn!=null){ > try { > this.conn.close(); > } catch (JMSException e) { > e.printStackTrace(); > } > } > } > } > > On Mon, Mar 3, 2014 at 9:59 PM, Christian Posta > wrote: > > If you build your broker using the java API you can do this by > > creating the policy entry and using its setters directly. > > > > Is that what you're asking? Otherwise you set the priority on a > > message by using the JMS APIs. > > > > On Mon, Mar 3, 2014 at 3:39 AM, Li Li wrote: > >> as in http://activemq.apache.org/how-can-i-support-priority-queues.html > , > >> I should enable queue priority by xml configuration. is it possible to > >> use java api to configure this? > > > > > > > > -- > > Christian Posta > > http://www.christianposta.com/blog > > twitter: @christianposta > --001a11c29ca03faf0a04f3c294b0--