You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Saurabh Sharma <sa...@nviz.com> on 2016/01/27 07:41:53 UTC

Issue while extending out of the box classes

Hi,

I am facing issue while trying to extend any out of the box Ignite classes. I am trying to extend DataStreamerImpl class and overriding addData(K,V) method to do extra processing before saving it to cache.
I did not find bean definitions defined in Bean configuration file except Ignite configuration in Ignite.

If I need to extend any bean which has parametrized constructor then I had to define that constructor of base class into my child class. I passed constructor argument through Bean configuration file.

public CustomStreamer(
               final GridKernalContext ctx,
               @Nullable final String cacheName,
               DelayQueue<DataStreamerImpl<K, V>> flushQ) {
              super(ctx, cacheName, flushQ);
       }

<bean id="igniteStreamer" class="org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl"/>
<bean id="kafkaStreamer" class="com.ignite.streamer.CustomStreamer " parent="igniteStreamer">
              <constructor-arg ref="ignite.ctx" index="0"/>
              <constructor-arg type="java.lang.String" value="igfs-data" index="1"/>
              <constructor-arg ref="delayQueue" index="2"/>
</bean>

But then it gave error for GridKernalContextImpl class like no default constructor defined which got resolved when I extended this class and defined parameterized constructor. But then again it contains many objects in constructor for which I again have to define beans and constructor arguments.

I wanted to confirm if this is the right approach or am I missing anything here.

Thanks,
Saurabh

Re: Issue while extending out of the box classes

Posted by vkulichenko <va...@gmail.com>.
Hi Saurabh,

DataStreamerImpl is an internal implementation class and it's not a good
idea to extend it to provide your own implementation.

If you want to implement your own streamer to integrate with another
product, refer to streamers implementation guideline [1]. Or you can use one
of the implementations that are already provided in Ignite.

[1]
https://cwiki.apache.org/confluence/display/IGNITE/Streamers+Implementation+Guidelines

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Issue-while-extending-out-of-the-box-classes-tp2733p2747.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Issue while extending out of the box classes

Posted by Roman Shtykh <rs...@yahoo.com>.
Hi Saurabh,
This may be not an answer to your question, but from the bean id I guess you try to implement a Kafka streamer.Please check if [1] will work for you.
[1] https://ignite.apache.org/releases/1.5.0.final/javadoc/org/apache/ignite/stream/kafka/KafkaStreamer.html
-Roman