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 E64EC10F87 for ; Wed, 5 Mar 2014 09:46:51 +0000 (UTC) Received: (qmail 64339 invoked by uid 500); 5 Mar 2014 09:46:51 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 63655 invoked by uid 500); 5 Mar 2014 09:46:47 -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 63640 invoked by uid 99); 5 Mar 2014 09:46:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Mar 2014 09:46:46 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of fancyerii@gmail.com designates 209.85.215.53 as permitted sender) Received: from [209.85.215.53] (HELO mail-la0-f53.google.com) (209.85.215.53) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Mar 2014 09:46:40 +0000 Received: by mail-la0-f53.google.com with SMTP id b8so517185lan.12 for ; Wed, 05 Mar 2014 01:46:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=qopqAmKNB3zLqZG191sWgxo+/LQFa/KFXd4IjsKCekg=; b=mOt4LeUw08+eLQxGPgmYh+q+tFiia1tqqQuPRyZ7iHxZKdi4lNXcOQWzuDGSC9wotq n4ztV5SAc/ckNmayW+f5y2TrZoZW6aNTOzGFM1XwenMKX3Sy5fCIlvY1WhwUDI4k2OEW r4pAjI4Kvkhg0bwYR+QVaBsACm/tq8ZV0W8P9Oqbgyo27UPEXnfKgZLkO09ZWphsUoaQ gbr/p9uHF++pDDW38MbX4vfCF78ybw4f/F/MdCsq90sSyTib8gEMBpxR0wlbJl0TIE6N PjRnRYTKFraYlcHoGbXy0kROxnQ2ipLJ4C9mv91G+mNLXIXNNFlKjIlWUunUZr54FR4p 5Tww== MIME-Version: 1.0 X-Received: by 10.152.6.101 with SMTP id z5mr706864laz.53.1394012779376; Wed, 05 Mar 2014 01:46:19 -0800 (PST) Received: by 10.112.158.170 with HTTP; Wed, 5 Mar 2014 01:46:19 -0800 (PST) In-Reply-To: References: Date: Wed, 5 Mar 2014 17:46:19 +0800 Message-ID: Subject: Re: is tens of thousands of session feasible? From: Li Li To: users@activemq.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org If I have one session and a receiver thread. this thread receive ten messages to ten worker thread. each worker thread acknowledge it's message? receiver thread: while(true){ Message msg=receiver.receive(); put msg to a ConcurrentLinkedList; Worker thread: while(true){ Message msg=getMessgeFromLinkedList(); process msg; msg.acknowledge(); } On Wed, Mar 5, 2014 at 5:08 PM, Noel OConnor wrote: > have you seen ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE > > see > http://activemq.apache.org/maven/apidocs/org/apache/activemq/ActiveMQSession.html#INDIVIDUAL_ACKNOWLEDGE > > > On Wed, Mar 5, 2014 at 6:48 PM, Li Li wrote: > >> hi all, >> I want to process a batch of message using my own priority >> algorithm. But in JMS, I can't acknowledge a single message and can >> only acknowledge a session. So I decide to do it like this: >> 1. Create N(=10000) sessions >> 2. using a thread to manage session acknowledge like: >> for(int i=0;i> if session acknowledged{ >> receive A Message without waiting; >> put this message to my own priority queue; >> } >> } >> 3. using another thread to process my own queue; >> get a message from my own queue; >> process this message; >> get the session of this message; >> acknowledge this session; >> >> because a session will receive only a message a time and it >> will be blocked until this message is processed. I need create many >> sessions(maybe I can make session a pool) . I don't know whether >> activemq can deal with so much session. for a single consumer, I will >> create 10000 session. if I have ten consumers, then 100,000 session be >> created at the same time. >>