You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2010/04/02 09:29:08 UTC
[jira] Created: (CAMEL-2607) CamelContextFactoryBean and
SpringCamelContext's onApplicationEvent() are all been called in Spring
3.0.1
CamelContextFactoryBean and SpringCamelContext's onApplicationEvent() are all been called in Spring 3.0.1
---------------------------------------------------------------------------------------------------------
Key: CAMEL-2607
URL: https://issues.apache.org/activemq/browse/CAMEL-2607
Project: Apache Camel
Issue Type: Improvement
Reporter: Willem Jiang
Assignee: Willem Jiang
Fix For: 2.3.0
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-2607) CamelContextFactoryBean and
SpringCamelContext's onApplicationEvent() are all been called in Spring
3.0.1
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58624#action_58624 ]
Claus Ibsen commented on CAMEL-2607:
------------------------------------
Ah CamelContextFactoryBean implements Disposable and then I assume Spring keep it around so it can *destroy* what the factory bean have created, which is SpringCamelContext.
So it should stick around.
But from a design point of view its not nice that its the factory bean which is the listener, when in realty it should be the SpringCamelContext. So I still do not think this solutions is the right.
> CamelContextFactoryBean and SpringCamelContext's onApplicationEvent() are all been called in Spring 3.0.1
> ---------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-2607
> URL: https://issues.apache.org/activemq/browse/CAMEL-2607
> Project: Apache Camel
> Issue Type: Improvement
> Reporter: Willem Jiang
> Assignee: Willem Jiang
> Fix For: 2.3.0
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-2607) CamelContextFactoryBean and
SpringCamelContext's onApplicationEvent() are all been called in Spring
3.0.1
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58629#action_58629 ]
Claus Ibsen commented on CAMEL-2607:
------------------------------------
After working a bit with this and registering the listener with the code above, Spring *still* does not invoke the onApplicationEvent method.
I recon we stick with the *workaround* by Willem.
> CamelContextFactoryBean and SpringCamelContext's onApplicationEvent() are all been called in Spring 3.0.1
> ---------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-2607
> URL: https://issues.apache.org/activemq/browse/CAMEL-2607
> Project: Apache Camel
> Issue Type: Improvement
> Reporter: Willem Jiang
> Assignee: Willem Jiang
> Fix For: 2.3.0
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-2607) CamelContextFactoryBean and
SpringCamelContext's onApplicationEvent() are all been called in Spring
3.0.1
Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58626#action_58626 ]
Willem Jiang commented on CAMEL-2607:
-------------------------------------
Maybe the CamelContextFactoryBean's solution is a workaround of the upper issue in the Spring 2.x time ;)
> CamelContextFactoryBean and SpringCamelContext's onApplicationEvent() are all been called in Spring 3.0.1
> ---------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-2607
> URL: https://issues.apache.org/activemq/browse/CAMEL-2607
> Project: Apache Camel
> Issue Type: Improvement
> Reporter: Willem Jiang
> Assignee: Willem Jiang
> Fix For: 2.3.0
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-2607) CamelContextFactoryBean and
SpringCamelContext's onApplicationEvent() are all been called in Spring
3.0.1
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58623#action_58623 ]
Claus Ibsen commented on CAMEL-2607:
------------------------------------
I do *not* think this is the right solution.
Now {{SpringCamelContext}} is not an {{ApplicationListener}} and how will you guarantee that Spring will invoke it?
CamelContextFactoryBean is (I assume) only active during creation of the CamelContext. Later at runtime this factory is *disposed*.
Then how can the camel-event component listen for Spring events?
What this change fixes is only during creation of SpringCamelContext to avoid the duplicate events. But I think we can remedy this in another way.
> CamelContextFactoryBean and SpringCamelContext's onApplicationEvent() are all been called in Spring 3.0.1
> ---------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-2607
> URL: https://issues.apache.org/activemq/browse/CAMEL-2607
> Project: Apache Camel
> Issue Type: Improvement
> Reporter: Willem Jiang
> Assignee: Willem Jiang
> Fix For: 2.3.0
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-2607) CamelContextFactoryBean and
SpringCamelContext's onApplicationEvent() are all been called in Spring
3.0.1
Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58625#action_58625 ]
Willem Jiang commented on CAMEL-2607:
-------------------------------------
@Claus,
This solution supports Spring 2.x and Spring 3.x at the same time.
I'm surprised even SprintCamelContext implements the ApplicationListener, the Spring2.x doesn't call its OnApplicationEvent method.
> CamelContextFactoryBean and SpringCamelContext's onApplicationEvent() are all been called in Spring 3.0.1
> ---------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-2607
> URL: https://issues.apache.org/activemq/browse/CAMEL-2607
> Project: Apache Camel
> Issue Type: Improvement
> Reporter: Willem Jiang
> Assignee: Willem Jiang
> Fix For: 2.3.0
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-2607) CamelContextFactoryBean and
SpringCamelContext's onApplicationEvent() are all been called in Spring
3.0.1
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58628#action_58628 ]
Claus Ibsen commented on CAMEL-2607:
------------------------------------
Ah we can register SpringCamelContext as listener using the
{code}
void addApplicationListener(ApplicationListener listener);
{code}
>From ConfigurableApplicationContext. Which we can do in SpringCamelContext itself. Then I think we do not need the listener at all on SpringCamelContextFactoryBean
> CamelContextFactoryBean and SpringCamelContext's onApplicationEvent() are all been called in Spring 3.0.1
> ---------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-2607
> URL: https://issues.apache.org/activemq/browse/CAMEL-2607
> Project: Apache Camel
> Issue Type: Improvement
> Reporter: Willem Jiang
> Assignee: Willem Jiang
> Fix For: 2.3.0
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (CAMEL-2607) CamelContextFactoryBean and
SpringCamelContext's onApplicationEvent() are all been called in Spring
3.0.1
Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Willem Jiang resolved CAMEL-2607.
---------------------------------
Resolution: Fixed
Fixed this issue by removing the ApplicationListener interface from SpringCamelContext.
> CamelContextFactoryBean and SpringCamelContext's onApplicationEvent() are all been called in Spring 3.0.1
> ---------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-2607
> URL: https://issues.apache.org/activemq/browse/CAMEL-2607
> Project: Apache Camel
> Issue Type: Improvement
> Reporter: Willem Jiang
> Assignee: Willem Jiang
> Fix For: 2.3.0
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-2607) CamelContextFactoryBean and
SpringCamelContext's onApplicationEvent() are all been called in Spring
3.0.1
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58627#action_58627 ]
Claus Ibsen commented on CAMEL-2607:
------------------------------------
Yeah its a bit odd if Spring does not call the onApplicationEvent on SpringCamelContext when it implements the ApplicationListener.
The listener is defined as
{code}
package org.springframework.context;
import java.util.EventListener;
/**
* Interface to be implemented by application event listeners.
* Based on the standard <code>java.util.EventListener</code> interface
* for the Observer design pattern.
*
* @author Rod Johnson
* @see org.springframework.context.event.ApplicationEventMulticaster
*/
public interface ApplicationListener extends EventListener {
/**
* Handle an application event.
* @param event the event to respond to
*/
void onApplicationEvent(ApplicationEvent event);
}
{code}
There is nothing in the javadoc that states how Spring detects this interface.
> CamelContextFactoryBean and SpringCamelContext's onApplicationEvent() are all been called in Spring 3.0.1
> ---------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-2607
> URL: https://issues.apache.org/activemq/browse/CAMEL-2607
> Project: Apache Camel
> Issue Type: Improvement
> Reporter: Willem Jiang
> Assignee: Willem Jiang
> Fix For: 2.3.0
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.