@@ -12,11 +12,15 @@ internal class TestLinkProcessor : ILinkProcessor
1212{
1313 private readonly Action < Message > _onMessage ;
1414 private readonly Action < MessageSourceInfo , MessageSource > _onMessageSource ;
15+ private readonly Action < MessageSourceInfo , MessageSource > _onMessageSourceClosed ;
1516
16- public TestLinkProcessor ( Action < Message > onMessage , Action < MessageSourceInfo , MessageSource > onMessageSource )
17+ public TestLinkProcessor ( Action < Message > onMessage ,
18+ Action < MessageSourceInfo , MessageSource > onMessageSource ,
19+ Action < MessageSourceInfo , MessageSource > onMessageSourceClosed )
1720 {
1821 _onMessage = onMessage ;
1922 _onMessageSource = onMessageSource ;
23+ _onMessageSourceClosed = onMessageSourceClosed ;
2024 }
2125
2226 public void Process ( AttachContext attachContext )
@@ -35,6 +39,10 @@ public void Process(AttachContext attachContext)
3539
3640 // override OnDispose so it won't throw NRE when message is null
3741 attachContext . Link . SetOnDispose ( ( _ , _ , _ , _ ) => { } ) ;
42+ attachContext . Link . AddSafeClosed ( ( _ , _ ) =>
43+ {
44+ _onMessageSourceClosed ( messageSourceInfo , messageSource ) ;
45+ } ) ;
3846
3947 attachContext . Link . CompleteAttach ( attachContext . Attach , null ) ;
4048 }
0 commit comments