@@ -30,10 +30,8 @@ namespace HelloAgent
30
30
{
31
31
32
32
[ TopicSubscription ( "HelloAgents" ) ]
33
- public class HelloAgent (
34
- RuntimeContext context , IHostApplicationLifetime hostApplicationLifetime ,
35
- [ FromKeyedServices ( "EventTypes" ) ] EventTypes typeRegistry ) : AgentBase (
36
- context ,
33
+ public class HelloAgent ( IHostApplicationLifetime hostApplicationLifetime ,
34
+ [ FromKeyedServices ( "EventTypes" ) ] EventTypes typeRegistry ) : Agent (
37
35
typeRegistry ) ,
38
36
IHandle < NewMessageReceived > ,
39
37
IHandle < ConversationClosed > ,
@@ -43,20 +41,20 @@ public async Task Handle(NewMessageReceived item, CancellationToken cancellation
43
41
{
44
42
var response = await SayHello ( item . Message ) . ConfigureAwait ( false ) ;
45
43
var evt = new Output { Message = response } ;
46
- await PublishMessageAsync ( evt ) . ConfigureAwait ( false ) ;
44
+ await PublishEventAsync ( evt ) . ConfigureAwait ( false ) ;
47
45
var goodbye = new ConversationClosed
48
46
{
49
47
UserId = AgentId . Key ,
50
48
UserMessage = "Goodbye"
51
49
} ;
52
- await PublishMessageAsync ( goodbye ) . ConfigureAwait ( false ) ;
50
+ await PublishEventAsync ( goodbye ) . ConfigureAwait ( false ) ;
53
51
}
54
52
public async Task Handle ( ConversationClosed item , CancellationToken cancellationToken = default )
55
53
{
56
54
var goodbye = $ "********************* { item . UserId } said { item . UserMessage } ************************";
57
55
var evt = new Output { Message = goodbye } ;
58
- await PublishMessageAsync ( evt ) . ConfigureAwait ( true ) ;
59
- await PublishMessageAsync ( new Shutdown ( ) ) . ConfigureAwait ( false ) ;
56
+ await PublishEventAsync ( evt ) . ConfigureAwait ( true ) ;
57
+ await PublishEventAsync ( new Shutdown ( ) ) . ConfigureAwait ( false ) ;
60
58
}
61
59
62
60
public async Task Handle ( Shutdown item , CancellationToken cancellationToken = default )
0 commit comments