Hi BTW you can check out the source code on the trunk from here: http://activemq.apache.org/camel/source.html
Have you tried the ctrl + \ to see which threads is hanging its ctrl + break on Windows. On Mon, Jan 19, 2009 at 10:47 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: > Hi > > There is no shutdown in this example (yet). I am working on this by > adding a stop client on the trunk codebase. > > ActiveMQ can run Camel embedded. Have you considered running your > application as a AMQ Server. > > Camel is usually not run standalone but inside some other server such > as AMQ, SMX or a J2EE Server. > > > > On Mon, Jan 19, 2009 at 10:26 AM, selezovikj <semir.elezo...@gmail.com> wrote: >> >> I am looking at the camel-example-spring-jms example, but I can not see the >> code where the shutting down of Camel + Spring + AMQ is done. >> Can you please tell me how to perform shutdown from within the application >> code ? >> >> >> >> Claus Ibsen-2 wrote: >>> >>> It should be Spring that shutsdon the ActiveMQ broker and not Camel. >>> AMQ is defined in spring. So if you can get Spring to shutdown nicely >>> then it should also shutdown all its beans. >>> >>> We run AMQ embedded in many unit tests in Camel and when we stop the >>> unit test we stop the camel context, and spring application context >>> and it nicely shuts down AMQ as well. >>> >>> Since Camel is a spring bean itself you should be able to just get >>> Spring shutting down then it should shutdown all its bean and thus >>> also Camel and AMQ. >>> >>> What's in the log when you stop? >>> >>> Have you tried looking at the camel-example-jms that is in the Camel >>> distribution. Its started using Main and can start/shutdown >>> Camel+Spring+AMQ. >>> >>> >>> On Fri, Jan 16, 2009 at 10:49 AM, selezovikj <semir.elezo...@gmail.com> >>> wrote: >>>> >>>> I have a server which loads the application context with the parameter >>>> -ac >>>> camel-server.xml: >>>> >>>> <broker:broker useJmx="false" persistent="false" brokerName="localhost"> >>>> <broker:transportConnectors> >>>> <broker:transportConnector name="tcp" >>>> uri="tcp://localhost:61616"/> >>>> </broker:transportConnectors> >>>> </broker:broker> >>>> >>>> <!-- Connection factory for ActiveMQ endpoints --> >>>> <bean id="connectionFactoryActiveMQ" >>>> class="org.apache.activemq.ActiveMQConnectionFactory"> >>>> <property name="brokerURL" value="vm://localhost"/> >>>> </bean> >>>> >>>> <!----------> >>>> >>>> <bean id="inOutQueue" class="org.apache.activemq.command.ActiveMQQueue"> >>>> <constructor-arg value="inOutQueue"/> >>>> </bean> >>>> >>>> <bean id="checkinServices" >>>> >>>> class="org.springframework.jms.remoting.JmsInvokerServiceExporter"> >>>> <property name="serviceInterface" >>>> value="MyManager"/> >>>> <property name="service"> >>>> <bean class="MyManagerImpl"/> >>>> </property> >>>> </bean> >>>> >>>> >>>> <bean >>>> >>>> class="org.springframework.jms.listener.DefaultMessageListenerContainer"> >>>> <property name="connectionFactory" >>>> ref="connectionFactoryActiveMQ"/> >>>> <property name="destination" ref="inOutQueue"/> >>>> <property name="maxConcurrentConsumers" value="5"/> >>>> <property name="concurrentConsumers" value="5"/> >>>> <property name="messageListener" ref="checkinServices"/> >>>> </bean> >>>> >>>> Then I have a camel-client.xml file which I start up from my Java code. >>>> AbstractApplicationContext context = new >>>> ClassPathXmlApplicationContext("camel-client.xml"); >>>> >>>> myManager = (MyManager) context.getBean("checkinServices"); >>>> myManager.shutdown(); >>>> >>>> >>>> --------------------- >>>> >>>> So when the client sends a message to a queue defined in camel-client.xml >>>> on >>>> an activemq broker which was fired up by camel-server.xml, the server >>>> side >>>> processes the message with the services defined to listen on the >>>> respective >>>> queue. >>>> >>>> In the shutdown method I do the following: >>>> >>>> public void shutdown() throws Exception >>>> Main main = Main.getInstance(); >>>> if(main != null) { >>>> if(main.getApplicationContext() != null){ >>>> >>>> main.getApplicationContext().close(); >>>> // main.getApplicationContext().registerShutdownHook(); >>>> } >>>> } >>>> } >>>> >>>> >>>> I expect that in the shutdown method I am going to get the instance of >>>> Main >>>> that started the camel-server.xml applicatoin context and when I close it >>>> the active mq broker will be closed as well. >>>> >>>> Hope you can follow this through. >>>> Semir >>>> >>>> >>>> >>>> >>>> >>>> >>>> Claus Ibsen-2 wrote: >>>>> >>>>> Hi >>>>> >>>>> I would assume the AMQ is also shutting down the the >>>>> applicationContext is closed, so Spring is shutting down and thus >>>>> shuts down all the bean that is handling the lifecycle for. >>>>> >>>>> If you run the camel-jms example in Camel then the AMQ broker is also >>>>> stopping when you stop the example. >>>>> >>>>> We have lately patched the Main with a JVM shutdown hook so when you >>>>> press CLTR + C to stop it then it will also call doStop() so its >>>>> gracefully shutting down it all. >>>>> >>>>> Can you show the applicationContext and what you do to stop the Main? >>>>> And which version of Camel and AMQ are you using? >>>>> >>>>> >>>>> On Fri, Jan 16, 2009 at 10:00 AM, selezovikj <semir.elezo...@gmail.com> >>>>> wrote: >>>>>> >>>>>> I am using org.apache.camel.spring.Main -ac file.xml to start up Camel. >>>>>> In the xml file I have configuration for starting an ActiveMq broker on >>>>>> host >>>>>> 61616, defined queues, and also beans responsible for handling messages >>>>>> which are sent on the request/response queues. >>>>>> >>>>>> Now I want a way to gracefully shutdown the camel service. >>>>>> I see that in the doStop() method of the Main class the >>>>>> AbstractApplicationContext is closed. >>>>>> When this is closed, the activeMq broker which we fired up is still >>>>>> running. >>>>>> >>>>>> Can someone please explain me what precisely is going on when the >>>>>> applicationContext is closed ? >>>>>> Also how to gracefully stop the instance of Main that fired up the >>>>>> activeMq >>>>>> broker and that loads the xml configuration file ? >>>>>> >>>>>> Any help will be greatly appreciated >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://www.nabble.com/ApplicationContext-close-tp21495001s22882p21495001.html >>>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> ------- >>>>> Claus Ibsen >>>>> Apache Camel Committer >>>>> >>>>> Open Source Integration: http://fusesource.com >>>>> Blog: http://davsclaus.blogspot.com/ >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/ApplicationContext-close-tp21495001s22882p21495886.html >>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>> >>>> >>> >>> >>> >>> -- >>> ------- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/ApplicationContext-close-tp21495001s22882p21539401.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/