Internally the DefaultStateSerializer uses Kryo, so it should be able to handle 
the different types automatically and its optional to provide a state provider 
config. 

 

The classes you provide the keyClass and valueClass are registered with Kryo 
(right now it accepts only one entry, but it should be possible to support 
multiple classes in future).

 

If you really want custom serialization logic for your keys and values, you 
need to provide your own key and value serializer class that handles the 
different types internally.

 

Arun

 

From: anshu shukla <anshushuk...@gmail.com>
Reply-To: "user@storm.apache.org" <user@storm.apache.org>
Date: Saturday, March 4, 2017 at 9:57 PM
To: "user@storm.apache.org" <user@storm.apache.org>
Subject: Serializing states of multiple and different class types (Stateful 
bolts)

 

Hello, 

 

I am stuck at the situation with two stateful bolts in my topology and both 
stateful bolts have the different class for key , value and serialization 
logic.  

 

1- As per the docs for STORM-1.0.3 we can give only  1 entry for :  
topology.state.provider.config 

{
   "keyClass": "Optional fully qualified class name of the Key type.",
   "valueClass": "Optional fully qualified class name of the Value type.",
   "keySerializerClass": "Optional Key serializer implementation class.",
   "valueSerializerClass": "Optional Value Serializer implementation class.",
 }
 

2- Also I am unable to find any sample example for writing custom class for 
config.

 

-- 

Thanks & Regards,
Anshu Shukla

Reply via email to