Re: Kafka 2.3.0 - inMemoryKeyValueStore changes (KAFKA-7918) - java.lang.NullPointerException

2019-07-09 Thread Nitay Kufert
Now that makes sense :)
Thanks

On Tue, Jul 9, 2019 at 1:43 AM Sophie Blee-Goldman 
wrote:

> Hi Nitay,
>
> InMemoryKeyValueStore is in the internal package, not part of the public
> API, so it is not meant to be used directly since it's implementation may
> change at any time (as has happened here). It's intended that you use the
> store builders/suppliers to get a new state store, but as you noticed this
> means you do have to call init yourself. You can just use a
> MockProcessorContext to do so (see the unit tests of these stores for an
> example)
>
> Best,
> Sophie
>
> On Mon, Jul 8, 2019 at 5:14 AM Nitay Kufert  wrote:
>
> > Hey,
> > Following https://issues.apache.org/jira/browse/KAFKA-7918 I had to
> change
> > the current implementation of our unit tests.
> >
> > Before the change, I created a store using:
> > new InMemoryKeyValueStore[String, BigDecimal](
> > countersStoreName, Serdes.String, SpecificSerdes.bigDecimalSerde
> >   )
> >
> > It seems that post the change, I need to do:
> > Stores.keyValueStoreBuilder(
> > Stores.inMemoryKeyValueStore(countersStoreName), Serdes.String,
> > SpecificSerdes.bigDecimalSerde
> >   ).build()
> >
> > But when I do, and I try to use the "put" command like so:
> > countersStore.put("unique_key_1", BigDecimal(9.87))
> >
> > I get:
> >
> > An exception or error caused a run to abort.
> > java.lang.NullPointerException
> > at
> >
> >
> org.apache.kafka.streams.state.internals.MeteredKeyValueStore.put(MeteredKeyValueStore.java:160)
> >
> > When digging a little into the code, it seems that the "init" function is
> > not called, which in turn keep putTime un-initialized.
> >
> > Am I missing something?
> >
> > --
> >
> > Nitay Kufert
> > Backend Developer
> > [image: ironSource] 
> >
> > email nita...@ironsrc.com
> > mobile +972-54-5480021
> > fax +972-77-5448273
> > skype nitay.kufert.ssa
> > 9 Ehad Ha'am st. Tel- Aviv
> > ironsrc.com 
> > [image: linkedin]  [image:
> > twitter]  [image: facebook]
> >  [image: googleplus]
> > 
> > This email (including any attachments) is for the sole use of the
> intended
> > recipient and may contain confidential information which may be protected
> > by legal privilege. If you are not the intended recipient, or the
> employee
> > or agent responsible for delivering it to the intended recipient, you are
> > hereby notified that any use, dissemination, distribution or copying of
> > this communication and/or its content is strictly prohibited. If you are
> > not the intended recipient, please immediately notify us by reply email
> or
> > by telephone, delete this email and destroy any copies. Thank you.
> >
>


-- 

Nitay Kufert
Backend Developer
[image: ironSource] 

email nita...@ironsrc.com
mobile +972-54-5480021
fax +972-77-5448273
skype nitay.kufert.ssa
9 Ehad Ha'am st. Tel- Aviv
ironsrc.com 
[image: linkedin]  [image:
twitter]  [image: facebook]
 [image: googleplus]

This email (including any attachments) is for the sole use of the intended
recipient and may contain confidential information which may be protected
by legal privilege. If you are not the intended recipient, or the employee
or agent responsible for delivering it to the intended recipient, you are
hereby notified that any use, dissemination, distribution or copying of
this communication and/or its content is strictly prohibited. If you are
not the intended recipient, please immediately notify us by reply email or
by telephone, delete this email and destroy any copies. Thank you.


Re: Kafka 2.3.0 - inMemoryKeyValueStore changes (KAFKA-7918) - java.lang.NullPointerException

2019-07-08 Thread Sophie Blee-Goldman
Hi Nitay,

InMemoryKeyValueStore is in the internal package, not part of the public
API, so it is not meant to be used directly since it's implementation may
change at any time (as has happened here). It's intended that you use the
store builders/suppliers to get a new state store, but as you noticed this
means you do have to call init yourself. You can just use a
MockProcessorContext to do so (see the unit tests of these stores for an
example)

Best,
Sophie

On Mon, Jul 8, 2019 at 5:14 AM Nitay Kufert  wrote:

> Hey,
> Following https://issues.apache.org/jira/browse/KAFKA-7918 I had to change
> the current implementation of our unit tests.
>
> Before the change, I created a store using:
> new InMemoryKeyValueStore[String, BigDecimal](
> countersStoreName, Serdes.String, SpecificSerdes.bigDecimalSerde
>   )
>
> It seems that post the change, I need to do:
> Stores.keyValueStoreBuilder(
> Stores.inMemoryKeyValueStore(countersStoreName), Serdes.String,
> SpecificSerdes.bigDecimalSerde
>   ).build()
>
> But when I do, and I try to use the "put" command like so:
> countersStore.put("unique_key_1", BigDecimal(9.87))
>
> I get:
>
> An exception or error caused a run to abort.
> java.lang.NullPointerException
> at
>
> org.apache.kafka.streams.state.internals.MeteredKeyValueStore.put(MeteredKeyValueStore.java:160)
>
> When digging a little into the code, it seems that the "init" function is
> not called, which in turn keep putTime un-initialized.
>
> Am I missing something?
>
> --
>
> Nitay Kufert
> Backend Developer
> [image: ironSource] 
>
> email nita...@ironsrc.com
> mobile +972-54-5480021
> fax +972-77-5448273
> skype nitay.kufert.ssa
> 9 Ehad Ha'am st. Tel- Aviv
> ironsrc.com 
> [image: linkedin]  [image:
> twitter]  [image: facebook]
>  [image: googleplus]
> 
> This email (including any attachments) is for the sole use of the intended
> recipient and may contain confidential information which may be protected
> by legal privilege. If you are not the intended recipient, or the employee
> or agent responsible for delivering it to the intended recipient, you are
> hereby notified that any use, dissemination, distribution or copying of
> this communication and/or its content is strictly prohibited. If you are
> not the intended recipient, please immediately notify us by reply email or
> by telephone, delete this email and destroy any copies. Thank you.
>


Kafka 2.3.0 - inMemoryKeyValueStore changes (KAFKA-7918) - java.lang.NullPointerException

2019-07-08 Thread Nitay Kufert
Hey,
Following https://issues.apache.org/jira/browse/KAFKA-7918 I had to change
the current implementation of our unit tests.

Before the change, I created a store using:
new InMemoryKeyValueStore[String, BigDecimal](
countersStoreName, Serdes.String, SpecificSerdes.bigDecimalSerde
  )

It seems that post the change, I need to do:
Stores.keyValueStoreBuilder(
Stores.inMemoryKeyValueStore(countersStoreName), Serdes.String,
SpecificSerdes.bigDecimalSerde
  ).build()

But when I do, and I try to use the "put" command like so:
countersStore.put("unique_key_1", BigDecimal(9.87))

I get:

An exception or error caused a run to abort.
java.lang.NullPointerException
at
org.apache.kafka.streams.state.internals.MeteredKeyValueStore.put(MeteredKeyValueStore.java:160)

When digging a little into the code, it seems that the "init" function is
not called, which in turn keep putTime un-initialized.

Am I missing something?

-- 

Nitay Kufert
Backend Developer
[image: ironSource] 

email nita...@ironsrc.com
mobile +972-54-5480021
fax +972-77-5448273
skype nitay.kufert.ssa
9 Ehad Ha'am st. Tel- Aviv
ironsrc.com 
[image: linkedin]  [image:
twitter]  [image: facebook]
 [image: googleplus]

This email (including any attachments) is for the sole use of the intended
recipient and may contain confidential information which may be protected
by legal privilege. If you are not the intended recipient, or the employee
or agent responsible for delivering it to the intended recipient, you are
hereby notified that any use, dissemination, distribution or copying of
this communication and/or its content is strictly prohibited. If you are
not the intended recipient, please immediately notify us by reply email or
by telephone, delete this email and destroy any copies. Thank you.