You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by maneshbelchada <ma...@gmail.com> on 2013/08/16 12:33:56 UTC

Multicast issue

Hi, 

We are using the below configuration to send a file from single source to
multiple remote destinations. 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
        http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
        
	<routeContext id="gcgRatesOutbound"
xmlns="http://camel.apache.org/schema/spring">
		<route id="gcgRatesFileOut">	
			<from
uri="file:{{nas.root}}/{{gcg.out.prices.dir}}?delay={{poll.delay}}&amp;initialDelay={{initial.delay}}&amp;readLock=rename&amp;scheduledExecutorService=#scheduledExecutorService"
/>					
			<multicast stopOnException="true">
								
				<to
uri="scp://{{gcg.ste.Client1_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client1}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
/>
									
				<to
uri="scp://{{gcg.ste.Client2_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client2}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
/>				
				 
				<to
uri="scp://{{gcg.ste.Client3_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client3}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
/>						
			</multicast> 			
		</route>
	</routeContext>
</beans>

Using the above confirguration the file reaches the remote destinations,
which confirmed that the connection to all the remote destinations were
successfull.


We need that the file should be moved to the archive folder after the file
has been successfully transfered to all the remote destinations. 
And should move to error folder incase of any error. 


However, when I add the archival code (<To> element) as child  element to
the multicast element in the above configuration and use the <doTry> and the
<doCatch> tag to move the file to error folder incase of an error. The file
does not reach the remote destinations.
<doTry>	
	<multicast stopOnException="true" parallelProcessing="true">
								
				<to
uri="scp://{{gcg.ste.Client1_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client1}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
/>
									
				<to
uri="scp://{{gcg.ste.Client2_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client2}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
/>				
				 
				<to
uri="scp://{{gcg.ste.Client3_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client3}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
/>
		
		<to
uri="file://{{nas.root}}/{{gcg.out.prices.dir}}?fileName={{archive.dir}}" />
	</multicast> 
<doCatch>
	<exception>java.lang.Exception</exception>
		<handled>
			<constant>true</constant>
		</handled>					
					
		<to
uri="file://{{nas.root}}/{{gcg.out.prices.dir}}?fileName={{error.dir}}" />
</doCatch>
</doTry>
The file does not reach the remote destinations nor does it produce any log 
and the file is moved to archive folder. 


I tried placing the remote destinations, the archival code and the move to
error code in seperate routes and have its reference in a single multicast
as below 
<multicast stopOnException="true">
					
		<to uri="direct:Client1FileOut" />
						
		<to uri="direct:Client2FileOut" />															
	 
		<to uri="direct:Client3FileOut" />			
	 
		<to uri="direct:MoveToArchive" />					
</multicast>


<route id="gcgFileOut1">	
			<from uri="direct:Client1FileOut" />			
			<doTry>			
								
				<to
uri="scp://{{gcg.ste.Client1_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client1}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
/>
				<doCatch>
						<exception>java.lang.Exception</exception>
						<handled>
							<constant>true</constant>
						</handled>
						
						<to uri="direct:gcgError" />	
						
				</doCatch>
			</doTry>
		</route>

However, The file does not reach the remote destinations nor does it produce
any log  and the file is moved to archive folder.

Request you to please suggest.


Regards, 
Manesh Belchada




--
View this message in context: http://camel.465427.n5.nabble.com/Multicast-issue-tp5737388.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Multicast issue

Posted by maneshbelchada <ma...@gmail.com>.
Hi, 

As suggested I tries using <multicast shareUnitOfWork="true">

However, the file moved to archive folder along with
Test_2_19082013_3.txt.camelLock file 

Not sure why this file is also moved to archive when the file dropped was
Test_2_19082013_3.txt

Also there is folder named "ARCHIV~1" created in the drop location. 

Request you please suggest. 


Regards, 
Manesh Belchada



--
View this message in context: http://camel.465427.n5.nabble.com/Multicast-issue-tp5737388p5737507.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Multicast issue

Posted by maneshbelchada <ma...@gmail.com>.
Hi Claus, 

I am new to camel and dont understand how to use splitter in my case. 

I saw a few samples that uses split. But could not understand how it can be
used in my case. 

Can you please help me may be with  a sample. 



Regards, 
Manesh Belchada



--
View this message in context: http://camel.465427.n5.nabble.com/Multicast-issue-tp5737388p5737501.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Multicast issue

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Use the @user mailing list / forum for these kind of questions.
And please dont post the same question in private emails to the Camel
team members.
http://camel.apache.org/mailing-lists.html
http://camel.apache.org/discussion-forums.html

Apache Camel is a public project and all such kind of questions et all
should happen in the public.

About your question, see the shareUnitOfWork option
http://camel.apache.org/multicast.html

On Fri, Aug 16, 2013 at 12:33 PM, maneshbelchada
<ma...@gmail.com> wrote:
> Hi,
>
> We are using the below configuration to send a file from single source to
> multiple remote destinations.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:camel="http://camel.apache.org/schema/spring"
>         xmlns:util="http://www.springframework.org/schema/util"
>         xsi:schemaLocation="
>                 http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>                 http://www.springframework.org/schema/util
> http://www.springframework.org/schema/util/spring-util.xsd
>         http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>         <routeContext id="gcgRatesOutbound"
> xmlns="http://camel.apache.org/schema/spring">
>                 <route id="gcgRatesFileOut">
>                         <from
> uri="file:{{nas.root}}/{{gcg.out.prices.dir}}?delay={{poll.delay}}&amp;initialDelay={{initial.delay}}&amp;readLock=rename&amp;scheduledExecutorService=#scheduledExecutorService"
> />
>                         <multicast stopOnException="true">
>
>                                 <to
> uri="scp://{{gcg.ste.Client1_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client1}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
> />
>
>                                 <to
> uri="scp://{{gcg.ste.Client2_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client2}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
> />
>
>                                 <to
> uri="scp://{{gcg.ste.Client3_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client3}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
> />
>                         </multicast>
>                 </route>
>         </routeContext>
> </beans>
>
> Using the above confirguration the file reaches the remote destinations,
> which confirmed that the connection to all the remote destinations were
> successfull.
>
>
> We need that the file should be moved to the archive folder after the file
> has been successfully transfered to all the remote destinations.
> And should move to error folder incase of any error.
>
>
> However, when I add the archival code (<To> element) as child  element to
> the multicast element in the above configuration and use the <doTry> and the
> <doCatch> tag to move the file to error folder incase of an error. The file
> does not reach the remote destinations.
> <doTry>
>         <multicast stopOnException="true" parallelProcessing="true">
>
>                                 <to
> uri="scp://{{gcg.ste.Client1_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client1}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
> />
>
>                                 <to
> uri="scp://{{gcg.ste.Client2_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client2}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
> />
>
>                                 <to
> uri="scp://{{gcg.ste.Client3_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client3}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
> />
>
>                 <to
> uri="file://{{nas.root}}/{{gcg.out.prices.dir}}?fileName={{archive.dir}}" />
>         </multicast>
> <doCatch>
>         <exception>java.lang.Exception</exception>
>                 <handled>
>                         <constant>true</constant>
>                 </handled>
>
>                 <to
> uri="file://{{nas.root}}/{{gcg.out.prices.dir}}?fileName={{error.dir}}" />
> </doCatch>
> </doTry>
> The file does not reach the remote destinations nor does it produce any log
> and the file is moved to archive folder.
>
>
> I tried placing the remote destinations, the archival code and the move to
> error code in seperate routes and have its reference in a single multicast
> as below
> <multicast stopOnException="true">
>
>                 <to uri="direct:Client1FileOut" />
>
>                 <to uri="direct:Client2FileOut" />
>
>                 <to uri="direct:Client3FileOut" />
>
>                 <to uri="direct:MoveToArchive" />
> </multicast>
>
>
> <route id="gcgFileOut1">
>                         <from uri="direct:Client1FileOut" />
>                         <doTry>
>
>                                 <to
> uri="scp://{{gcg.ste.Client1_User_Name}}@{{gcg.ste.Host_Name}}:{{gcg.ste.Port_Number}}/{{gcg.ste.Destination_Client1}}?knownHostsFile={{ssh.knownHosts}}&amp;privateKeyFile={{ssh.privateKey}}"
> />
>                                 <doCatch>
>                                                 <exception>java.lang.Exception</exception>
>                                                 <handled>
>                                                         <constant>true</constant>
>                                                 </handled>
>
>                                                 <to uri="direct:gcgError" />
>
>                                 </doCatch>
>                         </doTry>
>                 </route>
>
> However, The file does not reach the remote destinations nor does it produce
> any log  and the file is moved to archive folder.
>
> Request you to please suggest.
>
>
> Regards,
> Manesh Belchada
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Multicast-issue-tp5737388.html
> Sent from the Camel Development mailing list archive at Nabble.com.



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