This module provides standard interface for AMQP communication as it is defined and used by edeposit.amqp.
The interface consists of reactToAMQPMessage() function, which receives two parameters - structure and UUID. UUID is not much important, but structure is usually namedtuple containing information what should module do.
After the work is done, reactToAMQPMessage() returns a value, which is then automatically transfered back to caller. If the exception is raised, it is also transfered in open and easy to handle way.
In this module, reactToAMQPMessage() is used only for receiving commands from the other side. Events caused by FTP users are handled by monitor.py.
Commands can create/change/remove users and so on. This is done by sending one of the following structures defined in structures.py:
AddUser, RemoveUser and ChangePassword requests at this moment returns just simple True. This may be changed later.
ListRegisteredUsers returns Userlist class.
SetUserSettings and GetUserSettings both returns UserSettings structure.
React to given (AMQP) message. message is usually expected to be collections.namedtuple() structure filled with all necessary data.
Parameters: |
|
---|---|
Returns: | response TODO: comment when the protocol will be ready |
Raises: | ValueError – if bad type of message structure is given. |