def __init__(self, connector, datastore, serviceName, serviceQueue, objectStoreQueue, **extra): ''' Runs Process init first and then creates required connections. @param connector: bus address @param connectorPort: bus port @param datastore: HSN 2 Data Store address @param serviceName: The name of the running service. @param serviceQueue: The queue the service should connect to. @param objectStoreQueue: The queue used for sending objects to the object store. ''' Process.__init__(self) self.serviceName = serviceName self.serviceQueue = serviceQueue connectorPort = extra.get('connectorPort', 5672) self.fwBus = Bus.initBus( host=connector, port=connectorPort, app_id=serviceName) self.fwBus.os_queue = objectStoreQueue self.osAdapter = HSN2ObjectStoreAdapter(bus=self.fwBus) self.dsAdapter = HSN2DataStoreAdapter(datastore)
def main(): # ------------------------------ # Main # aliases = Aliases() # Parse command line arguments cliargs = cliparse(aliases) # Configure logging logger = init_logger(cliargs) # Parse config file config = configparse(logger, cliargs) # Configure Bus fwkBus = Bus.createConfigurableBus(logger, config, "cli") # Main try: logger.debug("Connected to the bus.") disp = CommandDispatcher(fwkBus, logger, cliargs, config) disp.dispatch(cliargs.command, aliases) except BusException, e: logger.error("Cannot connect to HSN2 Bus because '%s'" % e) print "ERROR: Cannot connect to HSN2 Bus because '%s'" % e