camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernard Ligny (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CAMEL-11097) Injection of CamelContext inside a CamelContextAware bean
Date Thu, 30 Mar 2017 16:22:42 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-11097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15949321#comment-15949321
] 

Bernard Ligny edited comment on CAMEL-11097 at 3/30/17 4:22 PM:
----------------------------------------------------------------

Use case: Camel CDI with *multiple* contexts

{code:java}

public class ContextFactory {
		
   @Produces
   @ApplicationScoped
   @ContextName("ctx-1")
    public CamelContext createCamelContext1() {	
       // ...
    }
	
    @Produces
    @ApplicationScoped
    @ContextName("ctx-2")
    public CamelContext createCamelContext2() {	
       // ...
    }	
    
---

@ContextName("ctx-2")
public class MyRouteBuilder extends RouteBuilder {
	
	@PropertyInject(context="ctx-2", value="...")  // <= why having to set "context" (again)
?
	private String myProperty; 
}
{code} 

Would be nice to have a "smart" resolution in case no context is specified even there is more
than one camel context.
Ambiguity can be resolved by using the same context of the "outer" bean (eg the RouteBuilder
in my case)..




was (Author: bligny):
Use case: Camel CDI with *multiple* contexts

{code:java}

public class ContextFactory {
		
   @Produces
   @ApplicationScoped
   @ContextName("ctx-1")
    public CamelContext createCamelContext1() {	
       // ...
    }
	
    @Produces
    @ApplicationScoped
    @ContextName("ctx-2")
    public CamelContext createCamelContext2() {	
       // ...
    }	
    
---

@ContextName("ctx-2")
public class MyRouteBuilder extends AbstractRouteBuilder {
	
	@PropertyInject(context="ctx-2", value="...")  // <= why having to set "context" (again)
?
	private String myProperty; 
}
{code} 

Would be nice to have a "smart" resolution in case no context is specified even there is more
than one camel context.
Ambiguity can be resolved by using the same context of the "outer" bean (eg the RouteBuilder
in my case)..



> Injection of CamelContext inside a CamelContextAware bean
> ---------------------------------------------------------
>
>                 Key: CAMEL-11097
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11097
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-cdi
>    Affects Versions: 2.18.3
>            Reporter: Bernard Ligny
>            Priority: Minor
>
> See this thread on Camel Users forum:
> http://camel.465427.n5.nabble.com/Why-do-we-have-to-specify-a-context-for-PropertyInject-td5796699.html



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message