aries / net.globalid.aries.features.basicmessage / BasicMessageService

BasicMessageService

interface BasicMessageService

A service for working with basic messages according to the Aries RFC 0095.

Functions

createMessage

Creates a message for the given context (should be a connection ID), but does not send it.

abstract fun createMessage(agent: Agent, message: String, connectionContext: ConnectionContext): Single<BasicMessageRecord>

deleteMessage

Deletes the message with the given ID.

abstract fun deleteMessage(agent: Agent, messageId: String): Completable

getMessage

Returns a message record with the given ID.

abstract fun getMessage(agent: Agent, messageId: String): Single<BasicMessageRecord>

getMessagesForContext

Returns a list of messages over the given connection context. Using a service decorator context is not valid here.

abstract fun getMessagesForContext(agent: Agent, connectionContext: ConnectionContext): Single<List<BasicMessageRecord>>

processMessage

Processes the given message.

abstract fun processMessage(agent: Agent, message: BasicMessage, connectionContext: ConnectionContext): Single<BasicMessageRecord>

resendMessage

Recreates and sends a message with the given ID if we are the sender, otherwise returns an error. This function should not check if the message needs to be resent; it is the role of the controller to determine that. If sending is unsuccessful, we still signal success, but with a non-null throwable in the returned pair.

abstract fun resendMessage(agent: Agent, messageId: String): Single<Pair<BasicMessageRecord, Throwable?>>

sendMessage

Creates a message for the given connection context (should be a connection ID) and sends it. If sending is unsuccessful, the message record is still stored in the wallet. If sending is unsuccessful, we still signal success, but with a non-null throwable in the returned pair.

abstract fun sendMessage(agent: Agent, message: String, connectionContext: ConnectionContext): Single<Pair<BasicMessageRecord, Throwable?>>

Inheritors

DefaultBasicMessageService

See BasicMessageService.

class DefaultBasicMessageService : BasicMessageService