You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Andrei Shakirin <as...@talend.com> on 2014/07/11 17:38:50 UTC

Distinguish client or service in FactoryBeanListener for ENDPOINT_CREATED event

I have discovered the restriction of FactoryBeanListener in one customer use case.
This scenario dynamically downloads WS-Policies from custom ServiceRegistry and applies them to the CXF client and service.

Problem: it seems that there is not reliable way to determine that event ENDPOINT_CREATED was fired by client or by the service in the method:
    protected void handleEventInternal(Event ev, ReflectionServiceFactoryBean factory, Object... args) {
    }
Other events CLIENT_CREATED, PROXY_CREATED and SERVICE_CREATED help to distinguish client or service, but are fired too late (for example transport is already initialized to this time).

Proposals:
Option A: introduce additional optional attribute in ReflectionServiceFactoryBean defining was the factory created by the client or by the service.
Option B: fire additional events PRE_CLIENT_CREATE, PRE_SERVICE_CREATE before creation of client and service.

Any thoughts, objections?
Perhaps there are any other ideas how to resolve the issue?

Regards,
Andrei.


Re: Distinguish client or service in FactoryBeanListener for ENDPOINT_CREATED event

Posted by Daniel Kulp <dk...@apache.org>.
I think I would go with option B.  Extra events would be good.  

Dan


On Jul 11, 2014, at 11:38 AM, Andrei Shakirin <as...@talend.com> wrote:

> I have discovered the restriction of FactoryBeanListener in one customer use case.
> This scenario dynamically downloads WS-Policies from custom ServiceRegistry and applies them to the CXF client and service.
> 
> Problem: it seems that there is not reliable way to determine that event ENDPOINT_CREATED was fired by client or by the service in the method:
>    protected void handleEventInternal(Event ev, ReflectionServiceFactoryBean factory, Object... args) {
>    }
> Other events CLIENT_CREATED, PROXY_CREATED and SERVICE_CREATED help to distinguish client or service, but are fired too late (for example transport is already initialized to this time).
> 
> Proposals:
> Option A: introduce additional optional attribute in ReflectionServiceFactoryBean defining was the factory created by the client or by the service.
> Option B: fire additional events PRE_CLIENT_CREATE, PRE_SERVICE_CREATE before creation of client and service.
> 
> Any thoughts, objections?
> Perhaps there are any other ideas how to resolve the issue?
> 
> Regards,
> Andrei.
> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com