5656from ..transport .outbound .base import OutboundDeliveryError
5757from ..transport .outbound .manager import OutboundTransportManager , QueuedOutboundMessage
5858from ..transport .outbound .message import OutboundMessage
59- from ..transport .outbound .queue .base import BaseOutboundQueue
60- from ..transport .outbound .queue .loader import get_outbound_queue
6159from ..transport .outbound .status import OutboundSendStatus
6260from ..transport .wire_format import BaseWireFormat
6361from ..utils .stats import Collector
@@ -97,7 +95,6 @@ def __init__(self, context_builder: ContextBuilder) -> None:
9795 self .outbound_transport_manager : OutboundTransportManager = None
9896 self .root_profile : Profile = None
9997 self .setup_public_did : DIDInfo = None
100- self .outbound_queue : BaseOutboundQueue = None
10198
10299 @property
103100 def context (self ) -> InjectionContext :
@@ -211,8 +208,6 @@ async def setup(self):
211208 DocumentLoader , DocumentLoader (self .root_profile )
212209 )
213210
214- self .outbound_queue = get_outbound_queue (self .root_profile )
215-
216211 # Admin API
217212 if context .settings .get ("admin.enabled" ):
218213 try :
@@ -273,13 +268,6 @@ async def start(self) -> None:
273268 LOGGER .exception ("Unable to start outbound transports" )
274269 raise
275270
276- if self .outbound_queue :
277- try :
278- await self .outbound_queue .start ()
279- except Exception :
280- LOGGER .exception ("Unable to start outbound queue" )
281- raise
282-
283271 # Start up Admin server
284272 if self .admin_server :
285273 try :
@@ -303,7 +291,6 @@ async def start(self) -> None:
303291 default_label ,
304292 self .inbound_transport_manager .registered_transports ,
305293 self .outbound_transport_manager .registered_transports ,
306- self .outbound_queue ,
307294 self .setup_public_did and self .setup_public_did .did ,
308295 self .admin_server ,
309296 )
@@ -489,8 +476,6 @@ async def stop(self, timeout=1.0):
489476 shutdown .run (self .inbound_transport_manager .stop ())
490477 if self .outbound_transport_manager :
491478 shutdown .run (self .outbound_transport_manager .stop ())
492- if self .outbound_queue :
493- shutdown .run (self .outbound_queue .stop ())
494479
495480 # close multitenant profiles
496481 multitenant_mgr = self .context .inject_or (BaseMultitenantManager )
@@ -669,44 +654,14 @@ async def queue_outbound(
669654 self .admin_server .notify_fatal_error ()
670655 raise
671656 del conn_mgr
672- # If ``self.outbound_queue`` is specified (usually set via
673- # outbound queue `-oq` commandline option), use that external
674- # queue. Else save the message to an internal queue. This
675- # internal queue usually results in the message to be sent over
676- # ACA-py `-ot` transport.
677- if self .outbound_queue :
678- return await self ._queue_external (profile , outbound )
679- else :
680- return self ._queue_internal (profile , outbound )
681-
682- async def _queue_external (
683- self ,
684- profile : Profile ,
685- outbound : OutboundMessage ,
686- ) -> OutboundSendStatus :
687- """Save the message to an external outbound queue."""
688- async with self .outbound_queue :
689- targets = (
690- [outbound .target ] if outbound .target else (outbound .target_list or [])
691- )
692- for target in targets :
693- encoded_outbound_message = (
694- await self .outbound_transport_manager .encode_outbound_message (
695- profile , outbound , target
696- )
697- )
698- await self .outbound_queue .enqueue_message (
699- encoded_outbound_message .payload , target .endpoint
700- )
701-
702- return OutboundSendStatus .SENT_TO_EXTERNAL_QUEUE
657+ return await self ._queue_message (profile , outbound )
703658
704- def _queue_internal (
659+ async def _queue_message (
705660 self , profile : Profile , outbound : OutboundMessage
706661 ) -> OutboundSendStatus :
707662 """Save the message to an internal outbound queue."""
708663 try :
709- self .outbound_transport_manager .enqueue_message (profile , outbound )
664+ await self .outbound_transport_manager .enqueue_message (profile , outbound )
710665 return OutboundSendStatus .QUEUED_FOR_DELIVERY
711666 except OutboundDeliveryError :
712667 LOGGER .warning ("Cannot queue message for delivery, no supported transport" )
0 commit comments