UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FMessageEndpointBuilder Struct Reference

#include <MessageEndpointBuilder.h>

Public Member Functions

 FMessageEndpointBuilder (const FName &InName)
 
 FMessageEndpointBuilder (const FName &InName, const TSharedRef< IMessageBus, ESPMode::ThreadSafe > &InBus)
 
template<typename MessageType , typename HandlerType >
FMessageEndpointBuilderHandling (HandlerType *Handler, typename TRawMessageHandler< MessageType, HandlerType >::FuncType HandlerFunc)
 
template<typename MessageType >
FMessageEndpointBuilderHandling (typename TFunctionMessageHandler< MessageType >::FuncType HandlerFunc)
 
FMessageEndpointBuilderNotificationHandling (FOnBusNotification &&InHandler)
 
FMessageEndpointBuilderReceivingOnAnyThread ()
 
FMessageEndpointBuilderReceivingOnThread (ENamedThreads::Type NamedThread)
 
FMessageEndpointBuilderThatIsDisabled ()
 
template<typename HandlerType >
FMessageEndpointBuilderWithCatchall (HandlerType *Handler, typename TRawMessageCatchall< HandlerType >::FuncType HandlerFunc)
 
FMessageEndpointBuilderWithCatchall (FFunctionMessageCatchall::FuncType HandlerFunc)
 
FMessageEndpointBuilderWithHandler (const TSharedRef< IMessageHandler, ESPMode::ThreadSafe > &Handler)
 
FMessageEndpointBuilderWithInbox ()
 
TSharedPtr< FMessageEndpoint, ESPMode::ThreadSafeBuild ()
 
 operator TSharedPtr< FMessageEndpoint, ESPMode::ThreadSafe > ()
 

Detailed Description

Implements a message endpoint builder.

Constructor & Destructor Documentation

◆ FMessageEndpointBuilder() [1/2]

FMessageEndpointBuilder::FMessageEndpointBuilder ( const FName InName)
inline

Creates and initializes a new builder using the default message bus.

WARNING: This constructor must be called from the Game thread.

Parameters
InNameThe endpoint's name (for debugging purposes).
InBusThe message bus to attach the endpoint to.

◆ FMessageEndpointBuilder() [2/2]

FMessageEndpointBuilder::FMessageEndpointBuilder ( const FName InName,
const TSharedRef< IMessageBus, ESPMode::ThreadSafe > &  InBus 
)
inline

Creates and initializes a new builder using the specified message bus.

Parameters
InNameThe endpoint's name (for debugging purposes).
InBusThe message bus to attach the endpoint to.

Member Function Documentation

◆ Build()

TSharedPtr< FMessageEndpoint, ESPMode::ThreadSafe > FMessageEndpointBuilder::Build ( )
inline

Builds the message endpoint as configured.

Returns
A new message endpoint, or nullptr if it couldn't be built.

◆ Handling() [1/2]

template<typename MessageType , typename HandlerType >
FMessageEndpointBuilder & FMessageEndpointBuilder::Handling ( HandlerType Handler,
typename TRawMessageHandler< MessageType, HandlerType >::FuncType  HandlerFunc 
)
inline

Adds a message handler for the given type of messages (via raw function pointers).

It is legal to configure multiple handlers for the same message type. Each handler will be executed when a message of the specified type is received.

This overload is used to register raw class member functions.

Parameters
HandlerTypeThe type of the object handling the messages.
MessageTypeThe type of messages to handle.
HandlerThe class handling the messages.
HandlerFuncThe class function handling the messages.
Returns
This instance (for method chaining).
See also
WithCatchall, WithHandler

◆ Handling() [2/2]

template<typename MessageType >
FMessageEndpointBuilder & FMessageEndpointBuilder::Handling ( typename TFunctionMessageHandler< MessageType >::FuncType  HandlerFunc)
inline

Adds a message handler for the given type of messages (via TFunction object).

It is legal to configure multiple handlers for the same message type. Each handler will be executed when a message of the specified type is received.

This overload is used to register functions that are compatible with TFunction function objects, such as global and static functions, as well as lambdas.

Parameters
MessageTypeThe type of messages to handle.
FunctionThe function object handling the messages.
Returns
This instance (for method chaining).
See also
WithCatchall, WithHandler

◆ NotificationHandling()

FMessageEndpointBuilder & FMessageEndpointBuilder::NotificationHandling ( FOnBusNotification &&  InHandler)
inline

◆ operator TSharedPtr< FMessageEndpoint, ESPMode::ThreadSafe >()

FMessageEndpointBuilder::operator TSharedPtr< FMessageEndpoint, ESPMode::ThreadSafe > ( )
inline

Implicit conversion operator to build the message endpoint as configured.

Returns
The message endpoint.

◆ ReceivingOnAnyThread()

FMessageEndpointBuilder & FMessageEndpointBuilder::ReceivingOnAnyThread ( )
inline

Configures the endpoint to receive messages on any thread.

By default, the builder initializes the message endpoint to receive on the current thread. Use this method to receive on any available thread instead.

ThreadAny is the fastest way to receive messages. It should be used if the receiving code is completely thread-safe and if it is sufficiently fast. ThreadAny MUST NOT be used if the receiving code is not thread-safe. It also SHOULD NOT be used if the code includes time consuming operations, because it will block the message router, causing no other messages to be delivered in the meantime.

Returns
This instance (for method chaining).
See also
ReceivingOnThread

◆ ReceivingOnThread()

FMessageEndpointBuilder & FMessageEndpointBuilder::ReceivingOnThread ( ENamedThreads::Type  NamedThread)
inline

Configured the endpoint to receive messages on a specific thread.

By default, the builder initializes the message endpoint to receive on the current thread. Use this method to receive on a different thread instead.

Also see the additional notes for ReceivingOnAnyThread().

Parameters
NamedThreadThe name of the thread to receive messages on.
Returns
This instance (for method chaining).
See also
ReceivingOnAnyThread

◆ ThatIsDisabled()

FMessageEndpointBuilder & FMessageEndpointBuilder::ThatIsDisabled ( )
inline

Disables the endpoint.

Returns
This instance (for method chaining).

◆ WithCatchall() [1/2]

FMessageEndpointBuilder & FMessageEndpointBuilder::WithCatchall ( FFunctionMessageCatchall::FuncType  HandlerFunc)
inline

Adds a message handler for the given type of messages (via TFunction object).

It is legal to configure multiple handlers for the same message type. Each handler will be executed when a message of the specified type is received.

This overload is used to register functions that are compatible with TFunction function objects, such as global and static functions, as well as lambdas.

Parameters
MessageTypeThe type of messages to handle.
FunctionThe function object handling the messages.
Returns
This instance (for method chaining).
See also
WithHandler

◆ WithCatchall() [2/2]

template<typename HandlerType >
FMessageEndpointBuilder & FMessageEndpointBuilder::WithCatchall ( HandlerType Handler,
typename TRawMessageCatchall< HandlerType >::FuncType  HandlerFunc 
)
inline

Adds a message handler for the given type of messages (via raw function pointers).

It is legal to configure multiple handlers for the same message type. Each handler will be executed when a message of the specified type is received.

This overload is used to register raw class member functions.

Parameters
HandlerTypeThe type of the object handling the messages.
MessageTypeThe type of messages to handle.
HandlerThe class handling the messages.
HandlerFuncThe class function handling the messages.
Returns
This instance (for method chaining).
See also
WithHandler

◆ WithHandler()

FMessageEndpointBuilder & FMessageEndpointBuilder::WithHandler ( const TSharedRef< IMessageHandler, ESPMode::ThreadSafe > &  Handler)
inline

Registers a message handler with the endpoint.

It is legal to configure multiple handlers for the same message type. Each handler will be executed when a message of the specified type is received.

Parameters
HandlerThe handler to add.
Returns
This instance (for method chaining).
See also
Handling, WithCatchall

◆ WithInbox()

FMessageEndpointBuilder & FMessageEndpointBuilder::WithInbox ( )
inline

Enables the endpoint's message inbox.

The inbox is disabled by default.

Returns
This instance (for method chaining).

The documentation for this struct was generated from the following file: