Do it in prepare. The topology created in main() is serialized and sent via thrift to the nimbus. It is not possible to serialize and deserialized things like a database connection. The config map is one way you can pass pool configuration information though.
On Fri, Apr 3, 2015 at 4:37 PM, Adam Mitchell <[email protected]> wrote: > Where is the best place to create a JDBC connection pool, and register it > so that all of my bolts can access it? To borrow from the examples, would > you do that near WordCountTopology::main() and save the pool reference in > the Config map? That way IBolt::prepare() can use the map... > > Or the TopologyContext is also available in IBolt::prepare(). Would you > put it there somehow? > > If you're doing database dips in your bolts, how are you managing your > database connections? >
