I put together a simple example of this and described it here:  
https://softwarematters.wordpress.com/2015/11/02/deploying-a-properties-file-with-a-storm-topology/

pjm

From: Andrew Neilson <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Tuesday, October 27, 2015 at 4:31 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Cc: "Saraswat-Contractor, Umakant (CORP)" 
<[email protected]<mailto:[email protected]>>
Subject: Re: passing arguements to storm topology at load

An alternate way to do it is to get these values from a .properties file or 
with command-line args within your Topology class and then send it to your 
bolts by setting new values in the 
Config<https://github.com/apache/storm/blob/0.9.x-branch/storm-core/src/jvm/backtype/storm/Config.java>
 object that gets submitted with the topology. They will then be available to 
use through the stormConf 
map<https://github.com/apache/storm/blob/master/storm-core/src/jvm/backtype/storm/topology/IBasicBolt.java#L25>
 in the prepare() method of each of your bolts.

On Tue, Oct 27, 2015 at 1:21 PM Garcia-Contractor, Joseph (CORP) 
<[email protected]<mailto:[email protected]>> 
wrote:
So we have ourselves a topology that we need to pass an external variable to on 
load of the jar file.  We thought that the way to do this was to add additional 
arguments to storm.yaml for the worker:

worker.childopts: "-Xmx805306368 -Dmongodb.hosts=mongo.host 
-Dmongodb.ports=27017"

However the topology does not appear to be picking this up.

We also tried adding those arguments to the options to nimbus.childopts and 
supervisor.childopts.

Also tried from the command line of storm:

  storm jar mytopo.jar my.topo.foo.bar mytopo -Dmongodb.hosts=mongo.host 
-Dmongodb.ports=27017

Is there a way to do this?

Joe
________________________________
This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, notify the sender immediately by return email and delete the message 
and any attachments from your system.

Reply via email to