Update on this. Modifying the state store on another thread actually doesn’t 
work. I receive the error

java.lang.IllegalStateException: This should not happen as offset() should only 
be called while a record is processed
        at 
org.apache.kafka.streams.processor.internals.AbstractProcessorContext.offset(AbstractProcessorContext.java:138)
        at 
org.apache.kafka.streams.state.internals.CachingKeyValueStore.put(CachingKeyValueStore.java:203)
        at 
org.apache.kafka.streams.state.internals.CachingKeyValueStore.put(CachingKeyValueStore.java:198)

So is there a way to do this?

> On 25 Aug 2017, at 9:57 am, Eli Jordan <elias.k.jor...@gmail.com> wrote:
> 
> Hi
> 
> I have a kafka streams application, that uses a couple of stateful (i.e. 
> using key value stores) custom transformer implementations.
> 
> I'm aware that the scheduling of the punctuate method is based on stream 
> time. However, for my use case, this is not what I want, I need wallclock 
> scheduling.
> 
> My question is, what is the recommended way to achieve this, until KIP138 
> provides first class support for wallclock punctuate?
> 
> At the moment, I schedule a task to run using ScheduledExecutorService. 
> However, I'm uncertain whether it is safe to access and modify a 
> KeyValueStore from a non kafka streams thread. Is this a safe approach, or 
> will there be problems?
> 
> Thanks
> Eli

Reply via email to