I plan to write a module that dynamically creates agents based on the tasks that are assigned to them. Since the IDs of the agents are going to be generated on the fly, based on their tasks, I am wondering if there is any way to create the agents without having to predefine their JIDs on the server.
What I am to do (in pseudocode)
for i in range(num_of_agents()):
jid = create_id() #This creats an jid like 'task319@localhost' which is not already present on prosody localhost VirtualHost
agent = myAgent(jid, "fake_password")
agent.start()
What I did
As far as I understood from the document, the JIDs need to be defined first on the server in order to be used in agent creation. When I previously create an account with jid agent1@localhost on the server, agent creation is done smoothly with no errors. However, when I try to change the jid to something not predefined on the server, like agent2@localhost, I get the following error, though I have set allow_auto_registration flag on the Prosody's config file to true:
Traceback (most recent call last):
File "/home/mypc/spade-proj/proj1/lib/python3.7/site-packages/aioxmpp/node.py", line 824, in _on_main_done
task.result()
File "/home/mypc/spade-proj/proj1/lib/python3.7/site-packages/aioxmpp/node.py", line 989, in _main
yield from self._main_impl()
File "/home/mypc/spade-proj/proj1/lib/python3.7/site-packages/aioxmpp/node.py", line 951, in _main_impl
logger=self.logger)
File "/home/mypc/spade-proj/proj1/lib/python3.7/site-packages/aioxmpp/node.py", line 400, in connect_xmlstream
jid, metadata, negotiation_timeout, loop, logger,
File "/home/mypc/spade-proj/proj1/lib/python3.7/site-packages/aioxmpp/node.py", line 279, in _try_options
features=features,
File "/home/mypc/spade-proj/proj1/lib/python3.7/site-packages/aioxmpp/security_layer.py", line 1201, in negotiate_sasl
raise last_auth_error
File "/home/mypc/spade-proj/proj1/lib/python3.7/site-packages/aioxmpp/security_layer.py", line 1185, in negotiate_sasl
jid, features, xmlstream, transport)
File "/home/mypc/spade-proj/proj1/lib/python3.7/site-packages/aioxmpp/security_layer.py", line 983, in execute
intf, mechanism, token)
File "/home/mypc/spade-proj/proj1/lib/python3.7/site-packages/aioxmpp/security_layer.py", line 848, in _execute
yield from mechanism.authenticate(sm, token)
File "/home/mypc/spade-proj/proj1/lib/python3.7/site-packages/aiosasl/__init__.py", line 712, in authenticate
username, password = yield from self._credential_provider()
File "/home/mypc/spade-proj/proj1/lib/python3.7/site-packages/aioxmpp/security_layer.py", line 960, in credential_provider
text="authentication aborted by user")
aiosasl.AuthenticationFailure: user intervention: authentication failed: authentication aborted by user
Description
I plan to write a module that dynamically creates agents based on the tasks that are assigned to them. Since the IDs of the agents are going to be generated on the fly, based on their tasks, I am wondering if there is any way to create the agents without having to predefine their JIDs on the server.
What I am to do (in pseudocode)
What I did
As far as I understood from the document, the JIDs need to be defined first on the server in order to be used in agent creation. When I previously create an account with jid
agent1@localhost
on the server, agent creation is done smoothly with no errors. However, when I try to change the jid to something not predefined on the server, likeagent2@localhost
, I get the following error, though I have set allow_auto_registration flag on the Prosody's config file totrue
: