If you want the config file not to be packed with the code/jar and need to be 
in a location outside , the storm doesn't have a filesystem associated with it 
unlike hadoop which has its own distributed file system . If your storm cluster 
doubles as a hadoop cluster too which I have seen in many cases , I can use 
hdfs location to store the property file.


-----Original Message-----
From: Anand Nalya
Sent: 21-08-2014 PM 12:00
To: [email protected]
Subject: Re: Reading config.priperties file

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