You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by sic <si...@naver.com> on 2010/04/20 02:18:06 UTC

@PreDestroy in servicemix-bean

I'm using servicemix-bean(3.2.1 version of SMX) as a provider called by some
consumers(actually using servicemix-quartz).

When executing 'stop' over this SA by the JMX(JConsole), I wanna implement
some closing logic in servicemix-bean provider. I think it can manage to do
with certain method annotated to @PreDestroy when just only commanded 'stop'
or 'shutdown'. Whenever called by some consumers, however, it calls a method
annotated to @PreDestroy after disposing of onMessageExchange.

<bean:endpoint service="test:bean" endpoint="endpoint" bean="#ListenerBean"
/>

<bean id="ListenerBean" class="test.ListenerBean"/>

public class ListenerBean implements MessageExchangeListener {

    @Resource
    private DeliveryChannel channel;

    public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
        exchange.setStatus(ExchangeStatus.DONE);
        channel.send(exchange);
    }
    
    @PreDestroy
    public void destroy() {
    	// some closing logic
    }
}

hope some advice to resolve this problem

regards,
sic
-- 
View this message in context: http://old.nabble.com/%40PreDestroy-in-servicemix-bean-tp28287774p28287774.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: @PreDestroy in servicemix-bean

Posted by sic <si...@naver.com>.
Oh sorry for not checking the fixed lists.

This issues have already been resolved in SMX 3.2.2. 
If any guys are facing same problem, please refer to the SMXCOMP-336.

I have no choice but to upgrade the version of SMX against this kind of
case.

sic

sic wrote:
> 
> I'm using servicemix-bean(3.2.1 version of SMX) as a provider called by
> some consumers(actually using servicemix-quartz).
> 
> When executing 'stop' over this SA by the JMX(JConsole), I wanna implement
> some closing logic in servicemix-bean provider. I think it can manage to
> do with certain method annotated to @PreDestroy when just only commanded
> 'stop' or 'shutdown'. Whenever called by some consumers, however, it calls
> a method annotated to @PreDestroy after disposing of onMessageExchange.
> 
> <bean:endpoint service="test:bean" endpoint="endpoint"
> bean="#ListenerBean" />
> 
> <bean id="ListenerBean" class="test.ListenerBean"/>
> 
> public class ListenerBean implements MessageExchangeListener {
> 
>     @Resource
>     private DeliveryChannel channel;
> 
>     public void onMessageExchange(MessageExchange exchange) throws
> MessagingException {
>         exchange.setStatus(ExchangeStatus.DONE);
>         channel.send(exchange);
>     }
>     
>     @PreDestroy
>     public void destroy() {
>     	// some closing logic
>     }
> }
> 
> hope some advice to resolve this problem
> 
> regards,
> sic
> 

-- 
View this message in context: http://old.nabble.com/%40PreDestroy-in-servicemix-bean-tp28287774p28323512.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.