I have 2 actors that can talk to each other. Each has an FMessageEndpoint instance and currently they fire messages back and forth between each other using the Default Message Bus in Unreal.
So far so good.
The IMessageBus->Send() (implemented in FMessageEndpoint as well) takes a “Delay” argument. An FTimespan value, which can be configured FTimespan::FromSeconds(…), etc.
However, it doesn’t matter what value I use for the Delay… the message always arrives to the other actor’s handle method INSTANTLY.
I have tried FTimespan::FromSeconds(), even FTimespan::FromHours(). Also just the default FTimespan(D,H,S) constructor. All result in instantly-arriving messages.
It seems hardly anyone is using this module (hence my inability to find much written about it), but I’m wondering if a bug has crept into the code over time and the Delay is not working as expected?
// Creating the FMessageEndpoint and setting up Handler Delegate
messaging = FMessageEndpoint::Builder(TEXT("EndPoint")).Handling<FTestMessage>(this, &AMessageSendActor::HandleMessage);
// Sending a Message
if (target != nullptr) {
if (messaging->IsEnabled()) {
if (messaging->IsConnected()) {
messaging->Send(new FTestMessage("HOWDY!!!", this), target->messaging->GetAddress(), FTimespan(0, 0, 20)); // 20s delay
}
}
}
// Handling the message
void AMessageSendActor::HandleMessage(const FTestMessage& Message, const TSharedRef<IMessageContext, ESPMode::ThreadSafe>& Context)
{
UE_LOG(LogTemp, Warning, TEXT("%s, from: %s"), *Message.val, *Message.sender->GetName());
}