using System;
using System.Threading.Tasks;
using SharedModule;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus.Distributed;
namespace App2
{
///
/// Used to listen messages sent to App2 by App1.
///
public class App2TextEventHandler : IDistributedEventHandler, ITransientDependency
{
private readonly IDistributedEventBus _distributedEventBus;
public App2TextEventHandler(IDistributedEventBus distributedEventBus)
{
_distributedEventBus = distributedEventBus;
}
public Task HandleEventAsync(App1ToApp2TextEventData eventData)
{
Console.WriteLine("************************ INCOMING MESSAGE ****************************");
Console.WriteLine(eventData.TextMessage);
Console.WriteLine("**********************************************************************");
Console.WriteLine();
_distributedEventBus.PublishAsync(new App2TextReceivedEventData(eventData.TextMessage));
return Task.CompletedTask;
}
}
}