Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow side loading alternate inbound transports #322

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion aries_cloudagent/config/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,9 @@ def add_arguments(self, parser: ArgumentParser):
help="REQUIRED. Defines the inbound transport(s) on which the agent\
listens for receiving messages from other agents. This parameter can\
be specified multiple times to create multiple interfaces.\
Supported inbound transport types are 'http' and 'ws'.",
Built-in inbound transport types include 'http' and 'ws'.\
However, other transports can be loaded by specifying an absolute\
module path.",
)
parser.add_argument(
"-ot",
Expand Down
8 changes: 7 additions & 1 deletion aries_cloudagent/transport/inbound/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,14 @@ def register(self, config: InboundTransportConfiguration) -> str:

"""
try:
if '.' in config.module:
package, module = config.module.split('.', 1)
else:
package = MODULE_BASE_PATH
module = config.module

imported_class = ClassLoader.load_subclass_of(
BaseInboundTransport, config.module, MODULE_BASE_PATH
BaseInboundTransport, module, package
)
except (ModuleLoadError, ClassNotFoundError) as e:
raise InboundTransportRegistrationError(
Expand Down