You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vivekrao001 <vi...@gmail.com> on 2015/07/14 17:53:46 UTC
Camel Bindy bean as Parameter in Spring Jms Component using
@Consume
@Consume(uri = "jms:queue:TestQueueOne?concurrentConsumers=10")
public String onMyMessage1(Order order) {
//// Some logic
}
-- Bean Definition is as follows
@FixedLengthRecord(length = 4)
public class Order implements Serializable {
@DataField(pos = 1, length = 2)
private int orderNr;
@DataField(pos = 2, length = 2)
private String clientNr;
public int getOrderNr() {
return orderNr;
}
public void setOrderNr(int orderNr) {
this.orderNr = orderNr;
}
public String getClientNr() {
return clientNr;
}
public void setClientNr(String clientNr) {
this.clientNr = clientNr;
}
}
--- its giving the following error :
*No type converter available to convert from type*: java.lang.String to the
required type: com.myapp.component.Order with value 1122.
Could somebody help me, if I'm missing any configuration?
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Bindy-bean-as-Parameter-in-Spring-Jms-Component-using-Consume-tp5769301.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Bindy bean as Parameter in Spring Jms Component using @Consume
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Ah yeah there is no type converter that supports bindy as a fallback.
So you would need to use the dataformat as David says.
Though it begs the question for pojo consuming if we should add some
annotation to add a conversion step so you can point to a data format
/ type converter (the latter is usually implicit) or even call a
pojo/bean that does the transformation.
On Tue, Jul 14, 2015 at 6:57 PM, David Karlsen <da...@gmail.com> wrote:
> You need to define a dataformat step in your route:
> https://camel.apache.org/data-format.html for bindy:
> http://camel.apache.org/binding.html
> alternatively you can bind the dataformat to the endpoint:
> http://camel.apache.org/binding.html
>
>
> 2015-07-14 17:53 GMT+02:00 vivekrao001 <vi...@gmail.com>:
>
>> @Consume(uri = "jms:queue:TestQueueOne?concurrentConsumers=10")
>> public String onMyMessage1(Order order) {
>> //// Some logic
>> }
>>
>> -- Bean Definition is as follows
>> @FixedLengthRecord(length = 4)
>> public class Order implements Serializable {
>>
>> @DataField(pos = 1, length = 2)
>> private int orderNr;
>>
>> @DataField(pos = 2, length = 2)
>> private String clientNr;
>>
>> public int getOrderNr() {
>> return orderNr;
>> }
>>
>> public void setOrderNr(int orderNr) {
>> this.orderNr = orderNr;
>> }
>>
>> public String getClientNr() {
>> return clientNr;
>> }
>>
>> public void setClientNr(String clientNr) {
>> this.clientNr = clientNr;
>> }
>> }
>>
>> --- its giving the following error :
>> *No type converter available to convert from type*: java.lang.String to the
>> required type: com.myapp.component.Order with value 1122.
>>
>> Could somebody help me, if I'm missing any configuration?
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Camel-Bindy-bean-as-Parameter-in-Spring-Jms-Component-using-Consume-tp5769301.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> --
> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2
Re: Camel Bindy bean as Parameter in Spring Jms Component using @Consume
Posted by David Karlsen <da...@gmail.com>.
You need to define a dataformat step in your route:
https://camel.apache.org/data-format.html for bindy:
http://camel.apache.org/binding.html
alternatively you can bind the dataformat to the endpoint:
http://camel.apache.org/binding.html
2015-07-14 17:53 GMT+02:00 vivekrao001 <vi...@gmail.com>:
> @Consume(uri = "jms:queue:TestQueueOne?concurrentConsumers=10")
> public String onMyMessage1(Order order) {
> //// Some logic
> }
>
> -- Bean Definition is as follows
> @FixedLengthRecord(length = 4)
> public class Order implements Serializable {
>
> @DataField(pos = 1, length = 2)
> private int orderNr;
>
> @DataField(pos = 2, length = 2)
> private String clientNr;
>
> public int getOrderNr() {
> return orderNr;
> }
>
> public void setOrderNr(int orderNr) {
> this.orderNr = orderNr;
> }
>
> public String getClientNr() {
> return clientNr;
> }
>
> public void setClientNr(String clientNr) {
> this.clientNr = clientNr;
> }
> }
>
> --- its giving the following error :
> *No type converter available to convert from type*: java.lang.String to the
> required type: com.myapp.component.Order with value 1122.
>
> Could somebody help me, if I'm missing any configuration?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Bindy-bean-as-Parameter-in-Spring-Jms-Component-using-Consume-tp5769301.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen