Package org.hildan.krossbow.stomp.conversions

Types

Link copied to clipboard
class KTypeRef<T>

Wraps a KType instance with a generic type parameter, to ensure type-safe usages.

Link copied to clipboard
interface StompSessionWithClassConversions : StompSession

A StompSession with additional methods to serialize/deserialize message bodies based on a KClass.

Link copied to clipboard
interface TextMessageConverter

Converts between text and objects based on a KClass.

Link copied to clipboard
interface TypedStompSession : StompSession

A StompSession with additional methods to serialize/deserialize message bodies based on a KClass.

Functions

Link copied to clipboard
inline suspend fun <T : Any> StompSessionWithClassConversions.convertAndSend(destination: String, body: T?): StompReceipt?
inline suspend fun <T> TypedStompSession.convertAndSend(destination: String, body: T): StompReceipt?
suspend fun <T : Any> StompSessionWithClassConversions.convertAndSend(    destination: String,     body: T? = null,     bodyType: KClass<T>): StompReceipt?

Sends a SEND frame to the server at the given destination with the given body, converted appropriately.

inline suspend fun <T : Any> StompSessionWithClassConversions.convertAndSend(headers: StompSendHeaders, body: T? = null): StompReceipt?
inline suspend fun <T> TypedStompSession.convertAndSend(headers: StompSendHeaders, body: T): StompReceipt?

Sends a SEND frame to the server with the given headers and body, converted appropriately.

Link copied to clipboard
inline suspend fun <T : Any> StompSessionWithClassConversions.subscribe(destination: String): Flow<T>
suspend fun <T : Any> StompSessionWithClassConversions.subscribe(destination: String, clazz: KClass<T>): Flow<T>

Subscribes and returns a Flow of messages of type T that unsubscribes automatically when the collector is done or cancelled. The returned flow can be collected only once.

inline suspend fun <T> TypedStompSession.subscribe(destination: String): Flow<T>

Subscribes to the given destination and returns a Flow of messages of type T that unsubscribes automatically when the collector is done or cancelled. The returned flow can be collected only once.

Link copied to clipboard
inline suspend fun <T : Any> StompSessionWithClassConversions.subscribeOptional(destination: String): Flow<T?>
suspend fun <T : Any> StompSessionWithClassConversions.subscribeOptional(destination: String, clazz: KClass<T>): Flow<T?>

Subscribes and returns a Flow of messages of type T that unsubscribes automatically when the collector is done or cancelled. The returned flow can be collected only once.

Link copied to clipboard
inline fun <T> typeRefOf(): KTypeRef<T>

Creates a KTypeRef representing the given type T.

Link copied to clipboard

Wraps this StompSession to add methods that can convert message bodies using the provided converter.