You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Pham Ngoc Hai (JIRA)" <ji...@apache.org> on 2010/11/24 07:49:24 UTC

[jira] Created: (CAMEL-3358) Consumer template ignores options in uri for file consumer

Consumer template ignores options in uri for file consumer
----------------------------------------------------------

                 Key: CAMEL-3358
                 URL: https://issues.apache.org/activemq/browse/CAMEL-3358
             Project: Apache Camel
          Issue Type: Bug
    Affects Versions: 2.2.0
         Environment: Debian sid i686
sun jdk 1.6.0_22-b04
apache-servicemix-4.2.0-fuse-02

            Reporter: Pham Ngoc Hai


I have an OSGi bundle:

My camel-context.xml:
------------
	<osgi:camelContext xmlns="http://camel.apache.org/schema/spring">					
		<template id="producer" />
		<consumerTemplate id="consumer" />
		<routeBuilder ref="routeBuilder"/>
	</osgi:camelContext>

	<bean id="routeBuilder" class="com.proiam.postmarque.customer.RouteBuilder">	
	</bean>
	
	<bean id="customerFilePolling" class="com.proiam.postmarque.customer.CustomerFilePolling">
		<property name="pullAddress" value="${pullAddress}" />
	</bean>
------------------
RouteBuilder:
------------------
		from("quartz://customer4pxfilein?cron=" + cronTime)		
		.beanRef("customer4PXFilePolling", "pollFiles");
-----------------
pollFiles:
-----------------
public class CustomerFilePolling {
	//@AutoWired gives me NPE
	@EndpointInject
	ConsumerTemplate consumer;
	//@AutoWired gives me NPE
	@EndpointInject
	ProducerTemplate producer;

        public void pollFiles() {
		while (true) {
			//System.out.println("Prepare to comsume");
			Exchange exchange = consumer.receive("file:///tmp/test/in?move=../done&readLock=changed", 2000);
			if (exchange == null) {
				break;
			}
			Exchange result = producer.send("activemq:queue:CustomerFileInBody", exchange);
			if (result.isFailed()) {
				System.out.println("pollFiles processor raised an error!");
			}
		}
	}
}

--------------
Everything is fine except that after being processed, the files are still there together with their .camelLock 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-3358) Consumer template ignores options in uri for file consumer

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-3358.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.5.0
         Assignee: Claus Ibsen

You need Camel 2.5 which has this fixed

> Consumer template ignores options in uri for file consumer
> ----------------------------------------------------------
>
>                 Key: CAMEL-3358
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3358
>             Project: Apache Camel
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>         Environment: Debian sid i686
> sun jdk 1.6.0_22-b04
> apache-servicemix-4.2.0-fuse-02
>            Reporter: Pham Ngoc Hai
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> I have an OSGi bundle:
> My camel-context.xml:
> ------------
> 	<osgi:camelContext xmlns="http://camel.apache.org/schema/spring">					
> 		<template id="producer" />
> 		<consumerTemplate id="consumer" />
> 		<routeBuilder ref="routeBuilder"/>
> 	</osgi:camelContext>
> 	<bean id="routeBuilder" class="com.proiam.postmarque.customer.RouteBuilder">	
> 	</bean>
> 	
> 	<bean id="customerFilePolling" class="com.proiam.postmarque.customer.CustomerFilePolling">
> 		<property name="pullAddress" value="${pullAddress}" />
> 	</bean>
> ------------------
> RouteBuilder:
> ------------------
> 		from("quartz://customer4pxfilein?cron=" + cronTime)		
> 		.beanRef("customer4PXFilePolling", "pollFiles");
> -----------------
> pollFiles:
> -----------------
> public class CustomerFilePolling {
> 	//@AutoWired gives me NPE
> 	@EndpointInject
> 	ConsumerTemplate consumer;
> 	//@AutoWired gives me NPE
> 	@EndpointInject
> 	ProducerTemplate producer;
>         public void pollFiles() {
> 		while (true) {
> 			//System.out.println("Prepare to comsume");
> 			Exchange exchange = consumer.receive("file:///tmp/test/in?move=../done&readLock=changed", 2000);
> 			if (exchange == null) {
> 				break;
> 			}
> 			Exchange result = producer.send("activemq:queue:CustomerFileInBody", exchange);
> 			if (result.isFailed()) {
> 				System.out.println("pollFiles processor raised an error!");
> 			}
> 		}
> 	}
> }
> --------------
> Everything is fine except that after being processed, the files are still there together with their .camelLock 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.