bAllowDelayedMessaging

bAllowDelayedMessaging

#Overview

name: bAllowDelayedMessaging

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bAllowDelayedMessaging is to control whether the Unreal Engine messaging system should allow delayed message delivery. This setting is specifically used in the message routing mechanism of the Engine’s messaging subsystem.

The Unreal Engine messaging subsystem relies on this setting variable. It’s primarily used within the FMessageRouter class, which is part of the core messaging infrastructure.

The value of this variable is set in the constructor of FMessageRouter. It’s initially set to false and then potentially overridden by a value from the engine configuration file (GEngineIni) using the GConfig system.

This variable interacts closely with the DelayedMessages container and the HandleRouteMessage function. When bAllowDelayedMessaging is true, messages with a send time in the future are queued in the DelayedMessages priority queue instead of being dispatched immediately.

Developers must be aware that enabling this feature can introduce complexity in message timing and ordering. Messages may not be delivered immediately when this setting is enabled, which could affect real-time behavior in certain scenarios.

Best practices when using this variable include:

  1. Consider the implications on system responsiveness and message ordering before enabling delayed messaging.
  2. If enabled, ensure that time-sensitive operations are designed to handle potential delays in message delivery.
  3. Use this feature judiciously, as it can make debugging message flow more challenging.
  4. When enabled, monitor the DelayedMessages queue to ensure it doesn’t grow unexpectedly large, which could indicate issues with message processing or timing.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:3431, section: [Messaging]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Messaging/Private/Bus/MessageRouter.cpp:19

Scope (from outer to inner):

file
function     FMessageRouter::FMessageRouter

Source code excerpt:

	, Stopping(false)
	, Tracer(MakeShared<FMessageTracer, ESPMode::ThreadSafe>())
	, bAllowDelayedMessaging(false)
{
	ActiveSubscriptions.FindOrAdd(IMessageBus::PATHNAME_All);
	WorkEvent = FPlatformProcess::GetSynchEventFromPool();

	GConfig->GetBool(TEXT("Messaging"), TEXT("bAllowDelayedMessaging"), bAllowDelayedMessaging, GEngineIni);
}


FMessageRouter::~FMessageRouter()
{
	FPlatformProcess::ReturnSynchEventToPool(WorkEvent);

#Loc: <Workspace>/Engine/Source/Runtime/Messaging/Private/Bus/MessageRouter.cpp:410

Scope (from outer to inner):

file
function     void FMessageRouter::HandleRouteMessage

Source code excerpt:


	// dispatch the message
	if (bAllowDelayedMessaging && (Context->GetTimeSent() > CurrentTime))
	{
		UE_LOG(LogMessaging, Verbose, TEXT("Queued message for dispatch"));

		DelayedMessages.HeapPush(FDelayedMessage(Context, ++DelayedMessagesSequence));
	}
	else

#Loc: <Workspace>/Engine/Source/Runtime/Messaging/Private/Bus/MessageRouter.h:329

Scope (from outer to inner):

file
class        class FMessageRouter : public FRunnable , private FSingleThreadRunnable

Source code excerpt:


	/** Whether or not to allow delayed messaging */
	bool bAllowDelayedMessaging;
};