Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 91032 invoked from network); 17 Mar 2010 10:12:19 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Mar 2010 10:12:19 -0000 Received: (qmail 59968 invoked by uid 500); 17 Mar 2010 10:12:19 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 59831 invoked by uid 500); 17 Mar 2010 10:12:19 -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 59818 invoked by uid 99); 17 Mar 2010 10:12:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Mar 2010 10:12:18 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of chubrilo@gmail.com designates 72.14.220.159 as permitted sender) Received: from [72.14.220.159] (HELO fg-out-1718.google.com) (72.14.220.159) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Mar 2010 10:12:12 +0000 Received: by fg-out-1718.google.com with SMTP id d23so872424fga.14 for ; Wed, 17 Mar 2010 03:11:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type; bh=W+QZA1ZCL60dbfbmuNv5CxzPnsOSruR+s3yoAJVVLkw=; b=raYldegz9WPOXn2iBDcpBvDNAC4ONP/0cntqq8+QTEjx6fO9k3yyR5HJYZSqvR0m1l eFa+B/fwfq+xyX3zFEKCJZpSvoe2dyRRkvMsveRbj42Le6+rp3eMohLRQhhvPj+vbS0e rDrHTYjUyn3zG0cULGtgatzvy0oAIkfgbGGUE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=kDptozmTNd58L/NNDyBkX5lHzs0EIZOCHkpKBDwBn2/QaLeOVdZy+zQBRXE2Ee8FzW qShPnBdFuptDAbjZoYy4Q7Me2QiJl95jY3O69asuzBqNG6xumZw+fwBNEfE728y83rvp idVeKHE5rAlu0tNR7coryThqKWYU9OHKcj+hE= MIME-Version: 1.0 Sender: chubrilo@gmail.com Received: by 10.239.136.9 with SMTP id f9mr771624hbf.3.1268820712214; Wed, 17 Mar 2010 03:11:52 -0700 (PDT) In-Reply-To: <27928619.post@talk.nabble.com> References: <27928619.post@talk.nabble.com> Date: Wed, 17 Mar 2010 11:11:52 +0100 X-Google-Sender-Auth: 672934e78cc52b51 Message-ID: <36e91d9d1003170311j16d657ay55e55ae529d61d2a@mail.gmail.com> Subject: Re: Loading embedded broker with an xml configuration From: Dejan Bosanac To: users@activemq.apache.org Content-Type: multipart/alternative; boundary=001485f1d774d5d0850481fc57dd X-Virus-Checked: Checked by ClamAV on apache.org --001485f1d774d5d0850481fc57dd Content-Type: text/plain; charset=ISO-8859-1 Hi Ami, that article seems a bit obsolete (I just updated it). You should use xbean: to try to load xml file from either classpath or file system. So try something like BrokerService service = BrokerFactory.createBroker(new URI("xbean:/workspace/apache-activemq-5.3.0/conf/activemq.xml")); Cheers -- Dejan Bosanac - http://twitter.com/dejanb Open Source Integration - http://fusesource.com/ ActiveMQ in Action - http://www.manning.com/snyder/ Blog - http://www.nighttale.net On Wed, Mar 17, 2010 at 10:15 AM, ami.rozen wrote: > > We are using activemq 5.1 and running a broker embedded in our java > application (a standard one). > Currently we are configuring the broker using java code. > The problems we have are: > 1.We don't seem to be able to make the broker use the temp storage (the > configuration is below) > 2.When using persistent = true storage files seems to always grow and are > never being deleted. > 3. We can't start the embedded broker using an external xml configuration > file. We tried understanding how to do it from > http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html > using the BrokerFactory with a url in the format of > file:foo/bar/activemq.xml but we get the following error: > Caused by: java.io.IOException: Could not find factory class for resource: > META-INF/services/org/apache/activemq/broker/file > at > > org.apache.activemq.util.FactoryFinder.doFindFactoryProperies(FactoryFinder.java:92) > at > org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:52) > at > org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:42) > at > > org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:41) > ... 11 more > > The java configuration of the broker is as follows: > > URI serviceUrl = new URI( brokerUri + "?jms.prefetchPolicy.all=" + > jmsMaxMessages + "&wireFormat.maxInactivityDuration=0" + "?useJmx=true" ); > > broker = new BrokerService(); > broker.setUseJmx( true ); > broker.addConnector( serviceUrl ); > broker.setPersistent( false ); > ManagementContext managementContext = new ManagementContext(); > managementContext.setConnectorPort( 1098 ); > broker.setManagementContext( managementContext ); > > SystemUsage memoryManager = new SystemUsage(); > MemoryUsage memoryUsage = new MemoryUsage(); > memoryUsage.setLimit( 512000000 ); > memoryManager.setMemoryUsage( memoryUsage ); > > TempUsage tempDiskUsage = new TempUsage(); > tempDiskUsage.setLimit( 100000000); > memoryManager.setTempUsage( tempDiskUsage ); > > StoreUsage storeUsage = new StoreUsage(); > storeUsage.setLimit( 999999999 ); > storeUsage.setName( "foo" ); > memoryManager.setStoreUsage( storeUsage ); > > broker.setSystemUsage( memoryManager ); > > broker.setTempDataStore( tempDataStore ); > broker.setTmpDataDirectory( new File( dataDirectory ) ); > > { > PersistenceAdapter adapter = broker.getPersistenceAdapter(); > adapter.setUsageManager( memoryManager ); > if( adapter instanceof AMQPersistenceAdapter ) > { > AMQPersistenceAdapter amqPersistenceAdapter = (AMQPersistenceAdapter) > adapter; > > if( persistent ) > amqPersistenceAdapter.setPersistentIndex( true ); > else > amqPersistenceAdapter.setPersistentIndex( false ); > } > } > broker.start(); > > We have tried to change the configuration in so many ways, none seems to > work ... > > Thank you for your help > Ami > -- > View this message in context: > http://old.nabble.com/Loading-embedded-broker-with-an-xml-configuration-tp27928619p27928619.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > > --001485f1d774d5d0850481fc57dd--