I am wondering how can I safely create a Singleton database connection and
use it through out the process.

Here is my scenario.

I got bunch of bolts that updates Cassandra database. I have reader and
writer classes where each needs a database session to execute queries. We
create session on each of the reader and writer classes. We also use
parallelism hints on the bolts which create that many instances of session
object.

I have tried creating session on topology and pass the instance through
stormConfig but didnt work with the error message below.

java.lang.IllegalArgumentException: Topology conf is not json-serializable
    at backtype.storm.testing$submit_local_topology.invoke(testing.clj:251)
~[storm-core-0.9.2-incubating.jar:0.9.2-incubating]
    at
backtype.storm.LocalCluster$_submitTopology.invoke(LocalCluster.clj:38)
~[storm-core-0.9.2-incubating.jar:0.9.2-incubating]
    at backtype.storm.LocalCluster.submitTopology(Unknown Source)
~[storm-core-0.9.2-incubating.jar:0.9.2-incubating]

Any code sample will be helpful.

--
Kushan Maskey
817.403.7500
Precocity LLC <http://precocity.com>
M. Miller & Associates <http://mmillerassociates.com/>
[email protected]

Reply via email to