>From memory, it seems like you are doing the same thing as I did.
On Sat, Jan 24, 2015 at 08:46 clay teahouse <[email protected]> wrote:

> Irek -- My reasons are that I don't want to deal with two different config
> objects and I want to deal with the config object in the prepare method.
>
> But I am considering both options (via constructor and prepare method). I
> am considering a singleton in the prepare method. But this might be an
> overkill.
>
> On Sat, Jan 24, 2015 at 10:28 AM, Irek Khasyanov <[email protected]> wrote:
>
>> Why you need to use storm's config? Use it only for storm configuration,
>> not for your topology.
>>
>> On 24 January 2015 at 19:17, clay teahouse <[email protected]>
>> wrote:
>>
>>> Thanks Irek. So you are passing the config through the bolt's
>>> constructor. I was trying to use storm's config  object to pass my own
>>> config around.
>>>
>>> On Sat, Jan 24, 2015 at 10:10 AM, Irek Khasyanov <[email protected]>
>>> wrote:
>>>
>>>> Well, I'm using this code:
>>>>
>>>> public EventsBatchBolt(TopologyConfig config, long emitFrequency,
>>>> TimeUnit unit) {
>>>>         super(emitFrequency, unit);
>>>>         topologyConfig = config;
>>>>     }
>>>>
>>>> And  where I submitting topology, I have:
>>>>
>>>> builder.setBolt("event_batch", new EventsBatchBolt(topologyConfig, 10,
>>>> TimeUnit.SECONDS), 1)
>>>>
>>>> TopologyConfig is just generic class with my configuration
>>>>
>>>> On 24 January 2015 at 18:59, clay teahouse <[email protected]>
>>>> wrote:
>>>>
>>>>> Any feedback on what the issue could be would be appreciated.
>>>>>  I am getting an instance of Config and add my static objects to it
>>>>> and want to access these objects in bolt's prepare method.
>>>>> Config config = new Config();
>>>>> config.put("objectname", objectinstance);
>>>>>
>>>>> StormSubmitter.submitTopology(topologyname, config, 
>>>>> builder.createTopology());
>>>>>
>>>>> And in bolt's prepare method, I try to extract the object.
>>>>>
>>>>> prepare(Map stormConfig,TopologyContext context) {
>>>>>
>>>>>    ObjectType obj = (objectType) stormConfig.get("objectname");
>>>>>
>>>>> }
>>>>>
>>>>> Object type  is either String or ArrayList or HashMap.
>>>>>
>>>>>
>>>>> On Sat, Jan 24, 2015 at 12:01 AM, clay teahouse <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I am trying to pass some objects to the bolts through config, but I
>>>>>> am not having much success. These objects are hashmap and arrarylists. I 
>>>>>> am
>>>>>> assuming these are serializable. Any idea what could be wrong?
>>>>>>
>>>>>> thanks,
>>>>>> Clay
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> With best regards, Irek Khasyanov.
>>>>
>>>
>>>
>>
>>
>> --
>> With best regards, Irek Khasyanov.
>>
>
>

Reply via email to