You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by ignitedFox <bl...@gmail.com> on 2017/05/31 08:28:49 UTC

How to create custom SinkRecord extractor?

hi,

I have records in kafka like;



Each record represents a "Bus" entry, with bus ID, route, etc. The records
are fetched from DB using Kafka JDBC Connector. I want to insert them to
Ignite, having "BUS_ID" as the key, and Bus object as the value. I got to
know that there need to do something like 



But I dont know how to do this. Somebody kindly help me on this?

Thank you



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-create-custom-SinkRecord-extractor-tp13261.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to create custom SinkRecord extractor?

Posted by ignitedFox <bl...@gmail.com>.
Hi Roman Shtykh,

As advised, I am continuing in the parent thread. Could you kindly have a
look at this post. Thanks a bunch for your help.

http://apache-ignite-users.70518.x6.nabble.com/How-to-solve-SinkRecord-cannot-be-cast-exception-unsolved-td13221.html#a13270



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-create-custom-SinkRecord-extractor-tp13261p13271.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to create custom SinkRecord extractor?

Posted by Roman Shtykh <rs...@yahoo.com>.
Check SinkRecord#value() [1]. Cast the object to the data type you use in your Kafka connector and extract the field you need.

And please continue posting your questions related to this topic in one thread -- we have a bunch already. Thank you!

[1] https://kafka.apache.org/0100/javadoc/index.html?org/apache/kafka/connect/sink/SinkRecord.html
-- Roman


    On Wednesday, May 31, 2017 5:29 PM, ignitedFox <bl...@gmail.com> wrote:
 

 hi,

I have records in kafka like;



Each record represents a "Bus" entry, with bus ID, route, etc. The records
are fetched from DB using Kafka JDBC Connector. I want to insert them to
Ignite, having "BUS_ID" as the key, and Bus object as the value. I got to
know that there need to do something like 



But I dont know how to do this. Somebody kindly help me on this?

Thank you



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-create-custom-SinkRecord-extractor-tp13261.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


   

Re: How to create custom SinkRecord extractor?

Posted by Humphrey <hm...@gmail.com>.
Can you keep everything in one thread, not creating new threads for each
question you have? Makes easy to follow the whole conversation.

You almost there, you just need to extract the values from the SinkRecord
and add them to your Bus object. See the Kafka API how to do extract values
from SinkRecord.

Related threads:
http://apache-ignite-users.70518.x6.nabble.com/How-to-solve-SinkRecord-cannot-be-cast-exception-unsolved-td13221.html
http://apache-ignite-users.70518.x6.nabble.com/Kindly-tell-me-where-to-find-these-jar-files-td12649.html
http://apache-ignite-users.70518.x6.nabble.com/Where-should-I-place-Kafka-connect-converter-class-files-td13214.html

Actually an answer was given here already
http://apache-ignite-users.70518.x6.nabble.com/How-to-configure-Ignite-sink-connector-to-use-key-value-td13162.html

Other related threads:
http://apache-ignite-users.70518.x6.nabble.com/How-to-implement-StreamSingleTupleExtractor-in-Kafka-connect-Ignite-sink-td13166.html




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-create-custom-SinkRecord-extractor-tp13261p13264.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.