-
1. Re: How to make Camel filter in SwitchYard component
jorgemoralespou_2 Oct 27, 2014 4:37 AM (in response to tungtd)Hi Tung,
This should work out of the box with SwitchYard. Make the Bean a @Named bean and use filter to select the method. I haven't tried it, but should work as it is Camel feature.
from("switchyard://StartService") .filter().method(MyBean.class, "isWhatIWant").to("switchyard://BostonService").end();
It is just a matter of you trying.
-
2. Re: How to make Camel filter in SwitchYard component
tungtd Oct 27, 2014 4:54 AM (in response to jorgemoralespou_2)Hi Jorge. There is no Bean in here. My Component has the Java interface and Java Camel DSL as the component's implementation. The Java interface has methods and I want to divide the invocation of each method to separating processing, for example:
from("switchyard://PersonManagement")
// if invoked method was save
to("sql:persistSomething....")
// if invoked method was delete
to("sql:deleteSomething...")
-
3. Re: How to make Camel filter in SwitchYard component
jorgemoralespou_2 Oct 27, 2014 5:16 AM (in response to tungtd)Hi Tung,
Then you have some options:
- To do ContentBasedRouting based on the method being invoked. (It is set as "org.switchyard.operationName").
- Have different implementations for you component, each for every method.
First option is the easiest one, so you could do something like:
from("switchyard://PersonManagement")
.choose()
.when(
header("org.switchyard.operationName").isEqualTo("save"))
.to("switchyard://sqlPersistSomething....")
.when(header("org.switchyard.operationName").isEqualTo("delete"))
.to("switchyard://sqlDeleteSomething...")
.otherwise()
.to("direct:error");
-
4. Re: How to make Camel filter in SwitchYard component
tungtd Oct 27, 2014 6:16 AM (in response to jorgemoralespou_2)Thank you very much, Jorge. But where can I find the properties such as "
org.switchyard.operationName". Is the anywhere I can find them?
-
5. Re: How to make Camel filter in SwitchYard component
jorgemoralespou_2 Oct 27, 2014 6:35 AM (in response to tungtd)Hi,
It is difficult to say. These properties are set internally by the engine. You can see them if you enable message tracing for the execution of a composite or debugging. I do not think there is documentation around these variables. I would encourage you to open a JIRA for a document with that info.
Keep in mind I'm a user not a SwitchYard developer ;-)