@@ -27,7 +27,7 @@ public MqttRouter(ILogger<MqttRouter> logger, MqttRouteTable routeTable, ITypeAc
27
27
this . typeActivator = typeActivator ;
28
28
}
29
29
30
- internal async Task OnIncomingApplicationMessage ( AspNetMqttServerOptionsBuilder options , MqttApplicationMessageInterceptorContext context , bool allowUnmatchedRoutes )
30
+ internal async Task OnIncomingApplicationMessage ( IServiceProvider svcProvider , InterceptingPublishEventArgs context , bool allowUnmatchedRoutes )
31
31
{
32
32
// Don't process messages sent from the server itself. This avoids footguns like a server failing to publish
33
33
// a message because a route isn't found on a controller.
@@ -48,11 +48,11 @@ internal async Task OnIncomingApplicationMessage(AspNetMqttServerOptionsBuilder
48
48
logger . LogDebug ( $ "Rejecting message publish because '{ context . ApplicationMessage . Topic } ' did not match any known routes.") ;
49
49
}
50
50
51
- context . AcceptPublish = allowUnmatchedRoutes ;
51
+ context . ProcessPublish = allowUnmatchedRoutes ;
52
52
}
53
53
else
54
54
{
55
- using ( var scope = options . ServiceProvider . CreateScope ( ) )
55
+ using ( var scope = svcProvider . CreateScope ( ) )
56
56
{
57
57
Type ? declaringType = routeContext . Handler . DeclaringType ;
58
58
@@ -83,7 +83,7 @@ internal async Task OnIncomingApplicationMessage(AspNetMqttServerOptionsBuilder
83
83
var controllerContext = new MqttControllerContext ( )
84
84
{
85
85
MqttContext = context ,
86
- MqttServer = scope . ServiceProvider . GetRequiredService < IMqttServer > ( )
86
+ MqttServer = scope . ServiceProvider . GetRequiredService < MqttServer > ( )
87
87
} ;
88
88
89
89
for ( int i = 0 ; i < activateProperties . Length ; i ++ )
@@ -94,7 +94,7 @@ internal async Task OnIncomingApplicationMessage(AspNetMqttServerOptionsBuilder
94
94
95
95
ParameterInfo [ ] parameters = routeContext . Handler . GetParameters ( ) ;
96
96
97
- context . AcceptPublish = true ;
97
+ context . ProcessPublish = true ;
98
98
99
99
if ( parameters . Length == 0 )
100
100
{
@@ -114,20 +114,20 @@ internal async Task OnIncomingApplicationMessage(AspNetMqttServerOptionsBuilder
114
114
{
115
115
logger . LogError ( ex , $ "Unable to match route parameters to all arguments. See inner exception for details.") ;
116
116
117
- context . AcceptPublish = false ;
117
+ context . ProcessPublish = false ;
118
118
}
119
119
catch ( TargetInvocationException ex )
120
120
{
121
121
logger . LogError ( ex . InnerException , $ "Unhandled MQTT action exception. See inner exception for details.") ;
122
122
123
123
// This is an unandled exception from the invoked action
124
- context . AcceptPublish = false ;
124
+ context . ProcessPublish = false ;
125
125
}
126
126
catch ( Exception ex )
127
127
{
128
128
logger . LogError ( ex , "Unable to invoke Mqtt Action. See inner exception for details." ) ;
129
129
130
- context . AcceptPublish = false ;
130
+ context . ProcessPublish = false ;
131
131
}
132
132
}
133
133
}
0 commit comments