.exchange
cattle_grid.exchange
create_router
create_router(
main_exchange: RabbitExchange | None = None,
include_shovels=True,
) -> RabbitRouter
Creates a router to be used to manage users
Source code in cattle_grid/exchange/__init__.py
actor_update
handle_actor_action
async
handle_actor_action(
actor: Actor, action: UpdateAction
) -> bool
Handles individual actions from the UpdateActor method
Source code in cattle_grid/exchange/actor_update/__init__.py
identifiers
handle_add_identifier
async
handle_add_identifier(
actor: Actor, action: UpdateIdentifierAction
)
Adds an identifier to the actor
FIXME: Currently missing logic to verify identifier
Source code in cattle_grid/exchange/actor_update/identifiers.py
handlers
delete_actor_handler
async
delete_actor_handler(
message: DeleteActorMessage,
actor: MessageActor,
broker: Annotated[RabbitBroker, Context()],
) -> None
Deletes the actor by id. Should be used asynchronously.
Source code in cattle_grid/exchange/handlers.py
update_actor
async
update_actor(
message: UpdateActorMessage,
actor: MessageActor,
broker: RabbitBroker = Context(),
) -> None
Should be used asynchronously
Source code in cattle_grid/exchange/handlers.py
info
exchange_method_information
module-attribute
exchange_method_information = [
MethodInformationModel(
module="cattle_grid.exchange",
routing_key="send_message",
description="Takes an activity and sends it to its recipients",
),
MethodInformationModel(
module="cattle_grid.exchange",
routing_key="update_actor",
description="Updates an actor",
),
MethodInformationModel(
module="cattle_grid.exchange",
routing_key="delete_actor",
description="Deletes an actor",
),
]
Information about the methods defined on the ActivityExchange by default
add_method_information
async
add_method_information(
message: AddMethodInformationMessage,
)
Adds information about methods defined by an extension
Source code in cattle_grid/exchange/info.py
message_handlers
send_message
async
send_message(
msg: ActivityMessage, broker: RabbitBroker = Context()
) -> None
Takes a message and ensure it is distributed appropriatelty
Source code in cattle_grid/exchange/message_handlers.py
shovel
should_shovel_activity
async
Some activities like Block or Undo Block should not be visible to the user. This method returns False if this is the case.