From dev-return-6632-apmail-activemq-dev-archive=activemq.apache.org@activemq.apache.org Wed May 16 03:31:54 2007 Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 18872 invoked from network); 16 May 2007 03:31:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 May 2007 03:31:54 -0000 Received: (qmail 49564 invoked by uid 500); 16 May 2007 03:32:00 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 49533 invoked by uid 500); 16 May 2007 03:32:00 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 49524 invoked by uid 99); 16 May 2007 03:32:00 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 May 2007 20:32:00 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of bruce.snyder@gmail.com designates 66.249.92.168 as permitted sender) Received: from [66.249.92.168] (HELO ug-out-1314.google.com) (66.249.92.168) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 May 2007 20:31:53 -0700 Received: by ug-out-1314.google.com with SMTP id m3so23752ugc for ; Tue, 15 May 2007 20:31:32 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=rIV5VH8E+3UCbtufObSy1e/1K+es6YpwFrzXcw4OMdR+choW8hVQ8xyb5TJCnNJg1V7zeDPTBt8tMtaWeCdesnVKBNgm8ZR5mMPCUri8s06BbzI/J40AaSOEKKuzOQbr5zl2OwmW9vl3Yx84gIPuzeb5k+jE9oMjbkM25P0OX6s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ft/qLVDQek6v80gZDOWXGQnpFVas3dVK7iJ32Tu1yzObmFBd2xKEs1vsQ1k1Lhe2Sr5ft6CKQ4EpXE2BF6XeOpYPErYAk2fdaVeVg+F6ahsAp59fR0CaxBYTb4AvzI9olwo7Y+rOoYl8AwBjCRAGJgu6G+2JZxz7T/Z17KUBfPc= Received: by 10.82.156.12 with SMTP id d12mr4966928bue.1179286292181; Tue, 15 May 2007 20:31:32 -0700 (PDT) Received: by 10.82.110.9 with HTTP; Tue, 15 May 2007 20:31:32 -0700 (PDT) Message-ID: <7b3355cb0705152031k6c284e5dnec611ac2689fd0ac@mail.gmail.com> Date: Tue, 15 May 2007 21:31:32 -0600 From: "Bruce Snyder" To: dev@activemq.apache.org Subject: Re: How to create BrokerService In-Reply-To: <10634843.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <10634843.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org On 5/15/07, Jiang wrote: > > I find BrokerFactory can create Broker. The method is createBroker(URI). If I > start one ActiveMQ Server on localhost and in Activemq.xml open > discoveryUri="multicast://default"/> > > > > jmxDomainName="org.apache.activemq"/> > > Then BrokerService service = BrokerFactory.createBroker(new URI("xxxxx")); > here URI("xxxxx") what should I specific xxxxx to connect to the ActiveMQ > server above?(What I mean is whether I can use createBroker to connect to > the Activemq server . Then I can get information about the server and admin > the server ) You can just use the URI for the transport connector you'd like the BrokerFactory to use from your configuration file. Below is an example of this: BrokerService service = BrokerFactory.createBroker(new URI("tcp://localhost:61616")); But I'm curious to know what exactly are you trying to do? If you're just trying to create a broker, it's much easier to create a BrokerService object and then just call getBroker() method to grab the actual Broker object (if you really need the Broker object - I'm willing to be you don't need it, but I could be wrong). Below is an example of this: BrokerService brokerService = new BrokerService(); brokerService.setUseJmx(true); brokerService.addConnector("tcp://localhost:61616"); brokerService.start(); Another option is to use the BrokerFactoryBean and a standard activemq.xml configuration file. Below is an example of this: BrokerFactoryBean factoryBean = new BrokerFactoryBean(new ClassPathResource("org/apache/servicemix/jms/activemq.xml")); factoryBean.afterPropertiesSet(); Broker broker = bfb.getBroker(); broker.start(); Hope this helps. Bruce -- perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E