Hi Kushan,

A slight variation on second approach suggested by Parth is to read the
properties file in your driver class on the gateway and copy all the
properties to the backtype.storm.Config object. In this way, the properties
will be available in the prepare/open method of your bolt/spout.

Regards,
Anand


On 21 August 2014 03:51, Parth Brahmbhatt <[email protected]>
wrote:

> Are you packing the config file in the jar? Does the config file get
> loaded on the gateway , where you run storm command, or its suppose to be
> loaded as part of spout’s/bolt's prepare method? In the former case you
> need to ensure that your property file is part of your jar file. If you are
> using maven you can do so by adding the following to your build target:
>         <resources>
>             <resource>
>                 <directory>src/resource</directory>
>             </resource>
>         </resources>
>
> and then in your code you can get a handle on the config file by
>
>
> SomeClass.class.getClassLoader().getResourceAsStream(“yourconfig.properties")
>
>
> The other way would be to just read the config file at the gateway, read
> the properties and set the property value as instance variables in the
> appropriate bolt and spout object. Ensure that the instance variables are
> not marked as transient.
>
> Thanks
> Parth
>
> If the config file is read and loaded at the gateway then are you storing
> On Aug 20, 2014, at 2:50 PM, Kushan Maskey <
> [email protected]> wrote:
>
> I pass the config file as an argument to the Topology.
>
>
>
> CONFIDENTIALITY NOTICE
> NOTICE: This message is intended for the use of the individual or entity
> to which it is addressed and may contain information that is confidential,
> privileged and exempt from disclosure under applicable law. If the reader
> of this message is not the intended recipient, you are hereby notified that
> any printing, copying, dissemination, distribution, disclosure or
> forwarding of this communication is strictly prohibited. If you have
> received this communication in error, please contact the sender immediately
> and delete it from your system. Thank You.

Reply via email to