You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by hanson2010 <ha...@gmail.com> on 2008/11/04 07:40:58 UTC

Shut down an embedded broker defined in Spring context

Spring context configuration is as below... Now my pain is I can start up the
broker with the application. But after captured Ctrl+C, the application
exits promptly. So I want to do this more gracefully to shut it down.

BTW, how can I switch on log output of the broker.

	<amq:broker useJmx="false" useShutdownHook="true" persistent="true"
		dataDirectory="./data">
		<amq:persistenceAdapter>
			<amq:amqPersistenceAdapter syncOnWrite="false"
				directory="./data" maxFileLength="32 mb" />
		</amq:persistenceAdapter>
		<amq:transportConnectors>
			<amq:transportConnector uri="tcp://localhost:${amq.port}" />
		</amq:transportConnectors>
	</amq:broker>

	<amq:queue id="destination" physicalName="${amq.queue}" />

	<amq:connectionFactory id="jmsConnectionFactory"
		brokerURL="vm://localhost" />
-- 
View this message in context: http://www.nabble.com/Shut-down-an-embedded-broker-defined-in-Spring-context-tp20316945p20316945.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Shut down an embedded broker defined in Spring context

Posted by hanson2010 <ha...@gmail.com>.
Thanks Gary. After turning on log output, I found that ActiveMQ's shutdown
hook was enabled by default. So it can close itself down whenever the host
application simply exited. No worry for now. :)



Gary Tully wrote:
> 
> add an id attribute to the amq:broker bean and get a handle on the
> bean using your spring context, then call shutdown on it.
> 
> for logging, see:
> http://activemq.apache.org/how-can-i-enable-detailed-logging.html
> 
> 2008/11/4 hanson2010 <ha...@gmail.com>:
>>
>> Spring context configuration is as below... Now my pain is I can start up
>> the
>> broker with the application. But after captured Ctrl+C, the application
>> exits promptly. So I want to do this more gracefully to shut it down.
>>
>> BTW, how can I switch on log output of the broker.
>>
>>        <amq:broker useJmx="false" useShutdownHook="true"
>> persistent="true"
>>                dataDirectory="./data">
>>                <amq:persistenceAdapter>
>>                        <amq:amqPersistenceAdapter syncOnWrite="false"
>>                                directory="./data" maxFileLength="32 mb"
>> />
>>                </amq:persistenceAdapter>
>>                <amq:transportConnectors>
>>                        <amq:transportConnector
>> uri="tcp://localhost:${amq.port}" />
>>                </amq:transportConnectors>
>>        </amq:broker>
>>
>>        <amq:queue id="destination" physicalName="${amq.queue}" />
>>
>>        <amq:connectionFactory id="jmsConnectionFactory"
>>                brokerURL="vm://localhost" />
>> --
>> View this message in context:
>> http://www.nabble.com/Shut-down-an-embedded-broker-defined-in-Spring-context-tp20316945p20316945.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Shut-down-an-embedded-broker-defined-in-Spring-context-tp20316945p20355336.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Shut down an embedded broker defined in Spring context

Posted by Gary Tully <ga...@gmail.com>.
add an id attribute to the amq:broker bean and get a handle on the
bean using your spring context, then call shutdown on it.

for logging, see:
http://activemq.apache.org/how-can-i-enable-detailed-logging.html

2008/11/4 hanson2010 <ha...@gmail.com>:
>
> Spring context configuration is as below... Now my pain is I can start up the
> broker with the application. But after captured Ctrl+C, the application
> exits promptly. So I want to do this more gracefully to shut it down.
>
> BTW, how can I switch on log output of the broker.
>
>        <amq:broker useJmx="false" useShutdownHook="true" persistent="true"
>                dataDirectory="./data">
>                <amq:persistenceAdapter>
>                        <amq:amqPersistenceAdapter syncOnWrite="false"
>                                directory="./data" maxFileLength="32 mb" />
>                </amq:persistenceAdapter>
>                <amq:transportConnectors>
>                        <amq:transportConnector uri="tcp://localhost:${amq.port}" />
>                </amq:transportConnectors>
>        </amq:broker>
>
>        <amq:queue id="destination" physicalName="${amq.queue}" />
>
>        <amq:connectionFactory id="jmsConnectionFactory"
>                brokerURL="vm://localhost" />
> --
> View this message in context: http://www.nabble.com/Shut-down-an-embedded-broker-defined-in-Spring-context-tp20316945p20316945.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>