def initialise_workflows() -> Dict[str, workflow.CommonWorkflow]: """Initialise the workflows :return: The workflows that can be used to handle messages. """ queue_adaptor = proton_queue_adaptor.ProtonQueueAdaptor( host=config.get_config('INBOUND_QUEUE_URL'), username=secrets.get_secret_config('INBOUND_QUEUE_USERNAME'), password=secrets.get_secret_config('INBOUND_QUEUE_PASSWORD')) raw_queue_adaptor = proton_queue_adaptor.ProtonQueueAdaptor( host=config.get_config('INBOUND_RAW_QUEUE_URL'), username=secrets.get_secret_config('INBOUND_QUEUE_USERNAME'), password=secrets.get_secret_config('INBOUND_QUEUE_PASSWORD')) sync_async_store = dynamo_persistence_adaptor.DynamoPersistenceAdaptor( table_name=config.get_config('SYNC_ASYNC_STATE_TABLE_NAME')) inbound_queue_max_retries = int( config.get_config('INBOUND_QUEUE_MAX_RETRIES', default='3')) inbound_queue_retry_delay = int( config.get_config('INBOUND_QUEUE_RETRY_DELAY', default='100')) persistence_store_max_retries = int( config.get_config('STATE_STORE_MAX_RETRIES', default='3')) sync_async_delay = int( config.get_config('SYNC_ASYNC_STORE_RETRY_DELAY', default='100')) work_description_store = dynamo_persistence_adaptor.DynamoPersistenceAdaptor( table_name=config.get_config('STATE_TABLE_NAME')) return workflow.get_workflow_map( raw_queue_adaptor=raw_queue_adaptor, inbound_async_queue=queue_adaptor, work_description_store=work_description_store, sync_async_store=sync_async_store, persistence_store_max_retries=persistence_store_max_retries, sync_async_store_retry_delay=sync_async_delay, inbound_queue_max_retries=inbound_queue_max_retries, inbound_queue_retry_delay=inbound_queue_retry_delay)
def initialise_workflows(transmission: outbound_transmission.OutboundTransmission, party_key: str, work_description_store: persistence_adaptor.PersistenceAdaptor, sync_async_store: persistence_adaptor.PersistenceAdaptor, max_request_size: int, persistence_store_retries: int, routing: routing_reliability.RoutingAndReliability) \ -> Dict[str, workflow.CommonWorkflow]: """Initialise the workflows :param transmission: The transmission object to be used to make requests to the spine endpoints :param party_key: The party key to use to identify this MHS. :param work_description_store: The persistence adaptor for the state database. :param sync_async_store: The persistence adaptor for the sync-async database. :param max_request_size: The maximum size of the request body that gets sent to Spine. :param persistence_store_retries The number of times to retry storing values in the work description or sync-async databases. :param routing: The routing and reliability component to use to request routing/reliability details from. :return: The workflows that can be used to handle messages. """ resynchroniser = resync.SyncAsyncResynchroniser( sync_async_store, int(config.get_config('RESYNC_RETRIES', '20')), float(config.get_config('RESYNC_INTERVAL', '1.0')), float(config.get_config('RESYNC_INITIAL_DELAY', '0'))) return workflow.get_workflow_map( party_key, work_description_store=work_description_store, transmission=transmission, resynchroniser=resynchroniser, max_request_size=max_request_size, persistence_store_max_retries=persistence_store_retries, routing=routing)
def test_get_workflow_map_for_inbound(self): workflow_map = workflow.get_workflow_map( inbound_async_queue=sentinel.queue_adaptor, inbound_queue_max_retries=3, inbound_queue_retry_delay=100) self.check_workflows_are_present(workflow_map)
def test_get_workflow_map_for_outbound(self): workflow_map = workflow.get_workflow_map( party_key=sentinel.party_key, work_description_store=sentinel.persistence_store, transmission=sentinel.transmission, routing=sentinel.routing_reliability) self.check_workflows_are_present(workflow_map)
def test_get_workflow_map_for_inbound(self): workflow_map = workflow.get_workflow_map( inbound_async_queue=sentinel.queue_adaptor) self.check_workflows_are_present(workflow_map)