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 <nita...@ironsrc.com> 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] <http://www.ironsrc.com>
>
> 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 <http://www.ironsrc.com>
> [image: linkedin] <https://www.linkedin.com/company/ironsource> [image:
> twitter] <https://twitter.com/ironsource> [image: facebook]
> <https://www.facebook.com/ironSource> [image: googleplus]
> <https://plus.google.com/+ironsrc>
> 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.
>

Reply via email to