package
0.0.3
Repository: https://github.com/sfomuseum/go-activitypub.git
Documentation: pkg.go.dev

# README

Queues

There two type of queues in the go-activitypub package. "Delivery" queues handle the details of delivery ActivityPub activities to one or more recipients (inboxes). "Processing" queues handle additional, or custom, processing of events related to ActivityPub messages received by the server application.

There are currently two "processing" queues:

  • A message processing queue with processes a message (which resolves to an ActivityPub "note") after its been received and recorded an account's inbox.
  • A follower processing queue with processes a follow event (as in a remote actor following an account) after its been received.

It is an open question whether or not to support multiple processing queues which bring with it the hassle and complexity of managing an equal number of queue endpoints. On the other hand it's too soon to know what sort of information would need to be passed, and how, to a single user-defined processing endpoint. For now, the decision is to be explicit and configure each processing queue with its own dispatcher and receiver.

Delivery queues

Delivery queues implement the DeliveryQueue interface:

type DeliveryQueue interface {
	DeliverActivity(context.Context, *deliver.DeliverActivityOptions) error
	Close(context.Context) error
}

Implementations

The following implementations of the DeliveryQueue interface are available by default:

null://

This implementation will receive an activity but not do anything with it. It is akin to writing data to /dev/null.

pubsub://

This implementation will dispatch the activity unique ActivityId property to an underlying implementation of the sfomuseum/go-pubsub/publisher.Publisher interface. That ID is expected to have been recorded in the ActivitiesDatabase table and that it can be retrieved by whatever code receives the message.

See also:

slog://

The implementation will log the activity using the default log/slog logger.

synchronous://

Message processing queues

Message processing queues implement the ProcessMessageQueue interface:

type ProcessMessageQueue interface {
	ProcessMessage(context.Context, int64) error
	Close(context.Context) error
}

Currently, "messages" are considered to be ActivityPub "Create" activities with type "Note". Remember a "message" in the go-activitypub is a pointer to a note associated with a specific account. Messages are dispatched to a ProcessMessageQueue as a final step in the www.InboxPostHandler in the server application.

There is no default endpoint, or code, for receiving or processing those messages after they have been dispatched. That is left up to individual users to implement, out of bounds, as their needs suit them. There is an example application for processing messages that you can use as "starter code" which can run from the command line or as a Lambda function. It does nothing more than validate the message, recipient account and associated note and logging those details.

Implementations

null://

This implementation will receive a message (ID) but not do anything with it. It is akin to writing data to /dev/null.

pubsub://

This implementation will dispatch a message ID to an underlying implementation of the sfomuseum/go-pubsub/publisher.Publisher interface. That ID is expected to have been recorded in the MessagesDatabase table and that it can be retrieved by whatever code receives the message.

See also:

slog://

The implementation will log the activity using the default log/slog logger.

Follower processing queues

Follower processing queues implement the ProcessFollowerQueue interface:

type ProcessFollowerQueue interface {
	ProcessFollower(context.Context, int64) error
	Close(context.Context) error
}

This queue is dispatched to with the unique 64-bit ID of the Follower record created in the FollowersDatabase when a remote actor follows an account hosted by the server application. Messages are dispatched to a ProcessFollowerQueue as a final step processing "Follow" events in the www.InboxPostHandler in the server application.

There is no default endpoint, or code, for receiving or processing those messages after they have been dispatched. That is left up to individual users to implement, out of bounds, as their needs suit them. There is an example application for processing messages that you can use as "starter code" which can run from the command line or as a Lambda function. It does nothing more than validate the message, recipient account and associated note and logging those details.

Implementations

null://

This implementation will receive a follower (ID) but not do anything with it. It is akin to writing data to /dev/null.

pubsub://

This implementation will dispatch a follower ID to an underlying implementation of the sfomuseum/go-pubsub/publisher.Publisher interface. That ID is expected to have been recorded in the FollowersDatabase table and that it can be retrieved by whatever code receives the event.

See also:

slog://

The implementation will log the follow(er) activity using the default log/slog logger.

# Functions

No description provided by the author
Schemes returns the list of schemes that have been registered.
NewDeliveryQueue returns a new `DeliveryQueue` instance configured by 'uri'.
No description provided by the author
No description provided by the author
No description provided by the author
NewProcessFollowerQueue returns a new `ProcessFollowerQueue` instance configured by 'uri'.
NewProcessMessageQueue returns a new `ProcessMessageQueue` instance configured by 'uri'.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Schemes returns the list of schemes that have been registered.
Schemes returns the list of schemes that have been registered.
RegisterDeliveryQueue registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `DeliveryQueue` instances by the `NewDeliveryQueue` method.
RegisterProcessFollowerQueue registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `ProcessFollowerQueue` instances by the `NewProcessFollowerQueue` method.
RegisterProcessMessageQueue registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `ProcessMessageQueue` instances by the `NewProcessMessageQueue` method.
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

DeliveryQueueInitializationFunc is a function defined by individual delivery_queue package and used to create an instance of that delivery_queue.
ProcessFollowerQueueInitializationFunc is a function defined by individual process_follow_queue package and used to create an instance of that process_follow_queue.
ProcessMessageQueueInitializationFunc is a function defined by individual process_message_queue package and used to create an instance of that process_message_queue.