You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by rsvalerio <rs...@gmail.com> on 2010/07/04 18:38:06 UTC

How to Use exclusiveReadLockStrategy property in file component?

Camel 2.2.0.

Property value:
exclusiveReadLockStrategy=my.package.definition.AppFileChangedExclusiveReadLockStrategy

This class extends FileChangedExclusiveReadLockStrategy, 

Get the erro, when start camel:
-------------------
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint:
file:///mnt/new?autoCreate=false&delete=true&exclusiveReadLockStrategy=my.package.definition.AppFileChangedExclusiveReadLockStrategy&maxMessagesPerPoll=1&readLock=changed&recursive=true
due to: Could not find a suitable setter for property:
exclusiveReadLockStrategy as there isn't a setter method with same type:
java.lang.String nor type conversion possible: No type converter available
to convert from type: java.lang.String to the required type:
org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy with
value my.package.definition.AppFileChangedExclusiveReadLockStrategy
-------------------


I try to define a field exclusiveReadLockStrategy of type
AppFileChangedExclusiveReadLockStrategy in my route class (RouteBuilder son)
but the erro persist.

Thanks in advance.

Rodrigo Valerio.
-- 
View this message in context: http://camel.465427.n5.nabble.com/How-to-Use-exclusiveReadLockStrategy-property-in-file-component-tp604330p604330.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to Use exclusiveReadLockStrategy property in file component?

Posted by Willem Jiang <wi...@gmail.com>.
rsvalerio wrote:
> No I`m using java dsl.
> 
> I don`t know what`s the trick.
> 
> camelContext.getRegistry()
OK, you can do the work like this

JndiRegistry registry = (JndiRegistry)camelContext.getRegistry();
registry.bind("myReadLockStrategy", new 
AppFileChangedExclusiveReadLockStrategy());

Willem
----------------------------------
Apache Camel, Apache CXF committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang


> 
> don`t have a method to use to set class in registry
> 
> Thanks
> 
> 
> 

Re: How to Use exclusiveReadLockStrategy property in file component?

Posted by rsvalerio <rs...@gmail.com>.
No I`m using java dsl.

I don`t know what`s the trick.

camelContext.getRegistry()

don`t have a method to use to set class in registry

Thanks


On Sun, Jul 4, 2010 at 11:07 PM, Willem.Jiang [via Camel]
<ml...@n5.nabble.com> wrote:
> Hi,
>
> You can register a instance of your
> AppFileChangedExclusiveReadLockStrategy into Camel registry with the
> name myReadLockStrategy.
>
> If you are using Spring , you just need to add below define
> <bean id=myReadLockStrategy
> class="my.package.definition.AppFileChangedExclusiveReadLockStrategy"
>
> then you can define your endpoint like this
> file:///mnt/new?autoCreate=false&delete=true&exclusiveReadLockStrategy=#myReadLockStrategy&maxMessagesPerPoll=1&readLock=changed&recursive=true
>
> Camel will look up the name which start with # from its registry.
>
> Willem
> ----------------------------------
> Apache Camel, Apache CXF committer
> Open SOA http://www.fusesource.com
> Blog http://willemjiang.blogspot.com
> Tiwtter http://twitter.com/willemjiang
>
>
>
>
> rsvalerio wrote:
>> Camel 2.2.0.
>>
>> Property value:
>>
>> exclusiveReadLockStrategy=my.package.definition.AppFileChangedExclusiveReadLockStrategy
>>
>> This class extends FileChangedExclusiveReadLockStrategy,
>>
>> Get the erro, when start camel:
>> -------------------
>> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
>> resolve endpoint:
>>
>> file:///mnt/new?autoCreate=false&delete=true&exclusiveReadLockStrategy=my.package.definition.AppFileChangedExclusiveReadLockStrategy&maxMessagesPerPoll=1&readLock=changed&recursive=true
>> due to: Could not find a suitable setter for property:
>> exclusiveReadLockStrategy as there isn't a setter method with same type:
>> java.lang.String nor type conversion possible: No type converter available
>> to convert from type: java.lang.String to the required type:
>> org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy with
>> value my.package.definition.AppFileChangedExclusiveReadLockStrategy
>> -------------------
>>
>>
>> I try to define a field exclusiveReadLockStrategy of type
>> AppFileChangedExclusiveReadLockStrategy in my route class (RouteBuilder
>> son)
>> but the erro persist.
>>
>> Thanks in advance.
>>
>> Rodrigo Valerio.
>
>
> ________________________________
> View message @
> http://camel.465427.n5.nabble.com/How-to-Use-exclusiveReadLockStrategy-property-in-file-component-tp604330p659450.html
> To unsubscribe from How to Use exclusiveReadLockStrategy property in file
> component?, click here.
>

-- 
View this message in context: http://camel.465427.n5.nabble.com/How-to-Use-exclusiveReadLockStrategy-property-in-file-component-tp604330p660716.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to Use exclusiveReadLockStrategy property in file component?

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

You can register a instance of your 
AppFileChangedExclusiveReadLockStrategy into Camel registry with the 
name myReadLockStrategy.

If you are using Spring , you just need to add below define
<bean id=myReadLockStrategy 
class="my.package.definition.AppFileChangedExclusiveReadLockStrategy"

then you can define your endpoint like this
file:///mnt/new?autoCreate=false&delete=true&exclusiveReadLockStrategy=#myReadLockStrategy&maxMessagesPerPoll=1&readLock=changed&recursive=true

Camel will look up the name which start with # from its registry.

Willem
----------------------------------
Apache Camel, Apache CXF committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang




rsvalerio wrote:
> Camel 2.2.0.
> 
> Property value:
> exclusiveReadLockStrategy=my.package.definition.AppFileChangedExclusiveReadLockStrategy
> 
> This class extends FileChangedExclusiveReadLockStrategy, 
> 
> Get the erro, when start camel:
> -------------------
> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
> resolve endpoint:
> file:///mnt/new?autoCreate=false&delete=true&exclusiveReadLockStrategy=my.package.definition.AppFileChangedExclusiveReadLockStrategy&maxMessagesPerPoll=1&readLock=changed&recursive=true
> due to: Could not find a suitable setter for property:
> exclusiveReadLockStrategy as there isn't a setter method with same type:
> java.lang.String nor type conversion possible: No type converter available
> to convert from type: java.lang.String to the required type:
> org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy with
> value my.package.definition.AppFileChangedExclusiveReadLockStrategy
> -------------------
> 
> 
> I try to define a field exclusiveReadLockStrategy of type
> AppFileChangedExclusiveReadLockStrategy in my route class (RouteBuilder son)
> but the erro persist.
> 
> Thanks in advance.
> 
> Rodrigo Valerio.