You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kikou1984 <hi...@atos.net> on 2012/09/20 09:18:16 UTC

Com between beans

Hi, 

I have a little problem, I do not know how to implement this idea. 

I explained the idea. 

I have this bean: .bean(EclatCCTIBean.class,"eclatCCTI"); 

That it returns: ArrayList <ArrayList <ClassA>> 

I want that each element of this table leads to another Beans that takes as
input:  ArrayList <ClassA>

Here is an example: 
Suppose the first Bean Returns an array that contains 5 of  <ArrayList
<ClassA> I wish that each Array Bean enters another successively. 

I think it's doable but I can not find enough examples on the net. 

Thank you in advance if anyone has an idea!



--
View this message in context: http://camel.465427.n5.nabble.com/Com-between-beans-tp5719646.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Com between beans

Posted by kikou1984 <hi...@atos.net>.
That's what i did for log, the data is not modified by the bean.

Here the log after the split :
"IN BEAN A "
"IN BEAN A "
"IN BEAN A "
"IN BEAN A "
"IN BEAN A "
"IN BEAN B "
"IN BEAN C "
"IN BEAN D "
"IN BEAN E "

I want that each element of the split be able to continue the sequence, i
want to see this kind of log.
"IN BEAN A "
"IN BEAN B "
"IN BEAN C "
"IN BEAN D "
"IN BEAN E " 

Once the sequence ends , the spliter should split the second element of the
Array and getting back to the sequence :
"IN BEAN A "
"IN BEAN B "
"IN BEAN C "
"IN BEAN D "
"IN BEAN E " 

I don't understand why all the element of the splitter getting to the first
Bean A successively ?!




--
View this message in context: http://camel.465427.n5.nabble.com/Com-between-beans-tp5719646p5719712.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Com between beans

Posted by Claus Ibsen <cl...@gmail.com>.
What do you bean's do with the message? If they modify it then that
can affect the splitter.
I suggest to try with beans that does nothing. Maybe just log, so you
can see what happens.

On Fri, Sep 21, 2012 at 9:43 AM, kikou1984 <hi...@atos.net> wrote:
> -> Sending another chaotic
>
> I will explain the problem as easily as possible :
>
>                       public void configure() {
>                            from("file:///D:/fileCamel/in?noop=true")
>                            .bean(First.class,"First")
>
> .split().method(XX.class,"DO").to("direct:THERE");
>
>                            from("direct:THERE").
>                            bean(A.class,"Toto").
>                            bean(B.class,"Tata").
>                            bean(C.class,"Titi").
>                            bean(D.class,"Tutu").
>                            bean(E.class,"Tyty").
>
> to("file:///D:/fileCamel/Sortie?fileName=firstUDK.txt");
>
>                            };
>                       });
>
> When i execute this code , the bean XX make a split and go to the route
> "THERE".
> We suppose that the split send 5 ArrayList to the route "THERE".
>
> I expect that when the code get into the route "THERE", the sequence of Bean
> will be {A,B,C,D,E},{A,B,C,D,E},{A,B,C,D,E},{A,B,C,D,E},{A,B,C,D,E}.
>
> But unfortunately, the sequence is like this with this code : {
> A,A,,A,A,A,B,C,D,E}.
>
> am I  more clear now ?
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Com-between-beans-tp5719646p5719710.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Com between beans

Posted by kikou1984 <hi...@atos.net>.
-> Sending another chaotic 

I will explain the problem as easily as possible :

                      public void configure() {
                           from("file:///D:/fileCamel/in?noop=true")
                           .bean(First.class,"First")        
                          
.split().method(XX.class,"DO").to("direct:THERE");
                           
                           from("direct:THERE").
                           bean(A.class,"Toto").
                           bean(B.class,"Tata").
                           bean(C.class,"Titi").
                           bean(D.class,"Tutu").
                           bean(E.class,"Tyty").
                          
to("file:///D:/fileCamel/Sortie?fileName=firstUDK.txt");

                           };                           
                      });

When i execute this code , the bean XX make a split and go to the route
"THERE".
We suppose that the split send 5 ArrayList to the route "THERE".

I expect that when the code get into the route "THERE", the sequence of Bean
will be {A,B,C,D,E},{A,B,C,D,E},{A,B,C,D,E},{A,B,C,D,E},{A,B,C,D,E}.

But unfortunately, the sequence is like this with this code : {
A,A,,A,A,A,B,C,D,E}.

am I  more clear now ?

 
 



--
View this message in context: http://camel.465427.n5.nabble.com/Com-between-beans-tp5719646p5719710.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Com between beans

Posted by Henryk Konsek <he...@gmail.com>.
> I tried this code :

Sending another chaotic code snippet to the mailing list doesn't take
you any closer to the getting the solution.

If you need help, you should *clearly* specify the problem in the first place.

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com

Re: Com between beans

Posted by kikou1984 <hi...@atos.net>.
Hi, 

I tried this code :

                      public void configure() {
                           from("file:///D:/fileCamel/in?noop=true")
//                           .bean(InitConcardisBean.class,"initialisation")
                          
.setHeader("TransactionClass",constant("net.awl.bfi.fluxRemisesConcardis.CorpsRemiseCB2AConcadis"))
                           .bean(MappingCB2ABean.class,"mapCb2acinObj2")
                           //.bean(EclatCCTIBean.class,"eclatCCTI")
                          
.split().method(EclatCCTIBean.class,"eclatCCTI").to("direct:echainement");
                           
                           from("direct:echainement").
                           bean(EclatDBCRBean.class,"eclatDBCR").
                          
bean(FormatLstCB2ABean.class,"refactCB2ADebCreBean").
                           bean(RefactCB2ABean.class,"refactCB2A").
                           bean(MappingUDKBean.class,"mapUdkInObj").
                           bean(MappingUDKBean.class,"makeFlatUDK").
                          
to("file:///D:/fileCamel/Sortie?fileName=firstUDK.txt");

In my exemple, i got 5 elements , unfortunately, the bean EclatDBCRBean is
executed 5 times, but i want all the bloc : 

                          bean(EclatDBCRBean.class,"eclatDBCR").
                          
bean(FormatLstCB2ABean.class,"refactCB2ADebCreBean").
                           bean(RefactCB2ABean.class,"refactCB2A").
                           bean(MappingUDKBean.class,"mapUdkInObj").
                           bean(MappingUDKBean.class,"makeFlatUDK").
                          
to("file:///D:/fileCamel/Sortie?fileName=firstUDK.txt");

be executed 5 times.

I know It  missing a little something :S

Thxs for u r help





--
View this message in context: http://camel.465427.n5.nabble.com/Com-between-beans-tp5719646p5719673.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Com between beans

Posted by kikou1984 <hi...@atos.net>.
Thank you for u r answer.

I ll explain more :) 
Here the data :


EclatCCTIBean.class -> public static ArrayList <ArrayList <ClassA>>
eclatCCTI(Exchange exchange) 
EclatDBCRBean.class -> ArrayList <ClassA> lstTransac = (ArrayList <ClassA>)
exchange.getIn().getBody();

Suppose that the first Bean contains 5 elements of ArrayList <ClassA>.
1 - 2 - 3 - 4 - 5.

I want to execute like this.

First Element make enter to this route: 
                              bean(EclatDBCRBean.class,"eclatDBCR"). 
                             
bean(FormatLstCB2ABean.class,"refactCB2ADebCreBean"). 
                              bean(RefactCB2ABean.class,"refactCB2A"); 
                              bean(MappingUDKBean.class,"mapUdkInObj"). 
                              bean(MappingUDKBean.class,"makeFlatUDK"). 
Then , the second element enter to this route :
                              bean(EclatDBCRBean.class,"eclatDBCR"). 
                             
bean(FormatLstCB2ABean.class,"refactCB2ADebCreBean"). 
                              bean(RefactCB2ABean.class,"refactCB2A"); 
                              bean(MappingUDKBean.class,"mapUdkInObj"). 
                              bean(MappingUDKBean.class,"makeFlatUDK"). 


Like this 3 4 5  for each element of ArrayList <ArrayList <ClassA>>.

That's why i made the split at EclatCCTIBean, i thought that the split will
decompose the  ArrayList <ArrayList <ClassA>> into element ArrayList
<ClassA> then i can get in 
                              bean(EclatDBCRBean.class,"eclatDBCR"). 
                             
bean(FormatLstCB2ABean.class,"refactCB2ADebCreBean"). 
                              bean(RefactCB2ABean.class,"refactCB2A"); 
                              bean(MappingUDKBean.class,"mapUdkInObj"). 
                              bean(MappingUDKBean.class,"makeFlatUDK"). 

Where can i put the loop? 

Thank you in advance



--
View this message in context: http://camel.465427.n5.nabble.com/Com-between-beans-tp5719646p5719660.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Com between beans

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Sep 20, 2012 at 10:50 AM, kikou1984 <hi...@atos.net> wrote:
> Hi ,
>
> i understood , i used the split like this :
>
>           try {
>                 context.addRoutes( new RouteBuilder() {
>                       public void configure() {
>                            from("file:///D:/fileCamel/in?noop=true")
> //                           .bean(InitConcardisBean.class,"initialisation")
> .setHeader("TransactionClass",constant("net.awl.bfi.fluxRemisesConcardis.CorpsRemiseCB2AConcadis"))
>                            .bean(MappingCB2ABean.class,"mapCb2acinObj2")
>                            .split().method(EclatCCTIBean.class,"eclatCCTI").
>                            bean(EclatDBCRBean.class,"eclatDBCR").
>
> bean(FormatLstCB2ABean.class,"refactCB2ADebCreBean").
>                            bean(RefactCB2ABean.class,"refactCB2A");
>                            bean(MappingUDKBean.class,"mapUdkInObj").
>                            bean(MappingUDKBean.class,"makeFlatUDK").
>
> to("file:///D:/fileCamel/Sortie?fileName=firstUDK.txt");
>
> Then , the bean : EclatCCTIBean.class will dispatch the ArrayList <ArrayList
> <ClassA>> in 5 ArrayList <ClassA> to the Bean 'EclatDBCRBean.class', but i
> want to execute five time the chain from EclatDBCRBean to MappingUDKBean
> with the 5 ArrayList <ClassA> from  ArrayList <ArrayList <ClassA>>.
>
> And it doesn't work !! if u can help me I would be grateful.
>

I dont think people understand what you really want.

Do you want to do like a for loop 5 times, or do you want to split a
message into smaller messages?

There is a loop eip as well. And if you use the copy option then it
uses the same input each time.

Alternative just write a java bean and call the other java beans yourself.
Then its just java code.



> thxs
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Com-between-beans-tp5719646p5719657.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Com between beans

Posted by kikou1984 <hi...@atos.net>.
Hi , 

i understood , i used the split like this :

          try {
                context.addRoutes( new RouteBuilder() {
                      public void configure() {
                           from("file:///D:/fileCamel/in?noop=true")
//                           .bean(InitConcardisBean.class,"initialisation")                          
.setHeader("TransactionClass",constant("net.awl.bfi.fluxRemisesConcardis.CorpsRemiseCB2AConcadis"))
                           .bean(MappingCB2ABean.class,"mapCb2acinObj2")
                           .split().method(EclatCCTIBean.class,"eclatCCTI").
                           bean(EclatDBCRBean.class,"eclatDBCR").
                          
bean(FormatLstCB2ABean.class,"refactCB2ADebCreBean").
                           bean(RefactCB2ABean.class,"refactCB2A");
                           bean(MappingUDKBean.class,"mapUdkInObj").
                           bean(MappingUDKBean.class,"makeFlatUDK").
                          
to("file:///D:/fileCamel/Sortie?fileName=firstUDK.txt");

Then , the bean : EclatCCTIBean.class will dispatch the ArrayList <ArrayList
<ClassA>> in 5 ArrayList <ClassA> to the Bean 'EclatDBCRBean.class', but i
want to execute five time the chain from EclatDBCRBean to MappingUDKBean
with the 5 ArrayList <ClassA> from  ArrayList <ArrayList <ClassA>>.

And it doesn't work !! if u can help me I would be grateful.

thxs





--
View this message in context: http://camel.465427.n5.nabble.com/Com-between-beans-tp5719646p5719657.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Com between beans

Posted by Claus Ibsen <cl...@gmail.com>.
He posted this same question on @dev first where we have given him an
answer already.


On Thu, Sep 20, 2012 at 9:18 AM, kikou1984 <hi...@atos.net> wrote:
> Hi,
>
> I have a little problem, I do not know how to implement this idea.
>
> I explained the idea.
>
> I have this bean: .bean(EclatCCTIBean.class,"eclatCCTI");
>
> That it returns: ArrayList <ArrayList <ClassA>>
>
> I want that each element of this table leads to another Beans that takes as
> input:  ArrayList <ClassA>
>
> Here is an example:
> Suppose the first Bean Returns an array that contains 5 of  <ArrayList
> <ClassA> I wish that each Array Bean enters another successively.
>
> I think it's doable but I can not find enough examples on the net.
>
> Thank you in advance if anyone has an idea!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Com-between-beans-tp5719646.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen