Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion samples/MessagingGAgent.Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using MessagingGAgent.Grains.Agents.Events;
using MessagingGAgent.Grains.Agents.Group;
using MessagingGAgent.Grains.Agents.Messaging;
using MessagingGAgent.Grains.Agents.Publisher;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 6 additions & 0 deletions src/Aevatar.Core.Abstractions/IPublishingGAgent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Aevatar.Core.Abstractions;

public interface IPublishingGAgent : IGAgent
{
Task PublishEventAsync<T>(T @event, params IGAgent[] agents) where T : EventBase;
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
using Aevatar.Core.Abstractions;
using Aevatar.Core.Tests.TestStateLogEvents;
using Microsoft.Extensions.Logging;
using Orleans.Providers;

namespace Aevatar.Core.Tests.TestGAgents;
namespace Aevatar.Core;

[GenerateSerializer]
public class PublishingAgentState : StateBase
{
}

public class PublishingStateLogEvent : StateLogEventBase<PublishingStateLogEvent>;
[GenerateSerializer]
public class PublishingStateLogEvent : StateLogEventBase<PublishingStateLogEvent>
{
}

[GAgent("publishing")]
[GAgent]
public class PublishingGAgent : GAgentBase<PublishingAgentState, PublishingStateLogEvent>, IPublishingGAgent
{
public override Task<string> GetDescriptionAsync()
{
return Task.FromResult("Agent to be used for publishing new events.");
}

public async Task PublishEventAsync<T>(T @event) where T : EventBase
public async Task PublishEventAsync<T>(T @event, params IGAgent[] agents) where T : EventBase
{
if (@event == null)
{
throw new ArgumentNullException(nameof(@event));
}

await RegisterManyAsync(agents.ToList());

Logger.LogInformation($"PublishingAgent publish {@event}");
await PublishAsync(@event);
Expand Down
8 changes: 0 additions & 8 deletions test/Aevatar.Core.Tests/TestGAgents/IPublishingGAgent.cs

This file was deleted.

2 changes: 1 addition & 1 deletion test/Aevatar.GAgents.Tests/GAgentFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public async Task CreateGAgentByGenericTypeTest()
var gAgent = await _gAgentFactory.GetGAgentAsync<IPublishingGAgent>();
gAgent.ShouldNotBeNull();
Should.NotThrow(() => gAgent.GetPrimaryKey());
gAgent.GetGrainId().ShouldBe(GrainId.Create("Aevatar.Core.Tests.TestGAgents.publishing",
gAgent.GetGrainId().ShouldBe(GrainId.Create("Aevatar.Core.PublishingGAgent",
gAgent.GetPrimaryKey().ToString("N")));
await CheckSubscribedEventsAsync(gAgent);
}
Expand Down
Loading