After a long quest to find information about the elusive IMessageBus in UE4, I finally have 2 Actors sending messages to each other.
Each has an FMessageEndPoint class, initialised like this:
messaging = FMessageEndpoint::Builder(TEXT("EndPoint")).Handling<FTestMessage>(this, &AMessageSendActor::HandleMessage);
A message is then sent:
if (messaging->IsEnabled()) {
if (messaging->IsConnected()) {
messaging->Send(new FTestMessage("HOWDY!!!"), target->messaging->GetAddress(), FTimespan::FromSeconds(100.0));
isSender = false;
}
}
Using the FTimespan::FromSeconds(100.0) I’m expecting a 100s delay.
However, the HandleMessage delegate INSTANTLY gets this message.
void AMessageSendActor::HandleMessage(const FTestMessage& Message, const TSharedRef<IMessageContext, ESPMode::ThreadSafe>& Context)
{
UE_LOG(LogTemp, Warning, TEXT("%s"), *Message.val);
}
I suspect I’m not understanding the process properly. Perhaps HandleMessage is meant to be instant? I notice the Deconstructor of the FTestMessage is also being called immediately, so presumably it’s not even being held in a queue anywhere?