Skip to content

Commit

Permalink
UseOpenTracingMiddleware extension fix namespace (#238)
Browse files Browse the repository at this point in the history
Co-authored-by: Radu Popovici <[email protected]>
  • Loading branch information
oncicaradupopovici and Radu Popovici authored Aug 9, 2022
1 parent 5cdd765 commit 502a689
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using NBB.Messaging.Abstractions;
using NBB.Messaging.Host;
using NBB.Messaging.OpenTracing.Publisher;
using NBB.Messaging.OpenTracing.Subscriber;
using OpenTracing;
using OpenTracing.Noop;
using OpenTracing.Util;
Expand Down Expand Up @@ -142,7 +141,7 @@ public Task Configure(IMessagingHostConfigurationBuilder hostConfigurationBuilde
.UsePipeline(pipelineBuilder => pipelineBuilder
.UseCorrelationMiddleware()
.UseExceptionHandlingMiddleware()
.UseMiddleware<OpenTracingMiddleware>()
.UseOpenTracingMiddleware()
.UseDefaultResiliencyMiddleware()
.UseMediatRMiddleware()
);
Expand Down
2 changes: 1 addition & 1 deletion samples/Orchestration/ProcessManagerSample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void ConfigureServicesDelegate(HostBuilderContext context, IServic
.UsePipeline(builder => builder
.UseCorrelationMiddleware()
.UseExceptionHandlingMiddleware()
//.UseMiddleware<OpenTracingMiddleware>()
//.UseOpenTracingMiddleware()
.UseDefaultResiliencyMiddleware()
.UseMiddleware<SubscriberLoggingMiddleware>()
.UseMediatRMiddleware())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@

using NBB.Core.Pipeline;
using NBB.Messaging.Abstractions;

namespace NBB.Messaging.OpenTracing.Subscriber
using NBB.Messaging.OpenTracing.Subscriber;

// ReSharper disable once CheckNamespace
namespace NBB.Messaging.Host;

public static class MessagingPipelineExtensions
{
public static class MessagingPipelineExtensions
{
/// <summary>
/// Adds to the pipeline a middleware that creates an OpenTracing span.
/// </summary>
/// <param name="pipelineBuilder">The pipeline builder.</param>
/// <returns>The pipeline builder for further configuring the pipeline. It is used used in the fluent configuration API.</returns>
public static IPipelineBuilder<MessagingContext> UseOpenTracing(
this IPipelineBuilder<MessagingContext> pipelineBuilder)
=> UseMiddleware<OpenTracingMiddleware>(pipelineBuilder);
/// <summary>
/// Adds to the pipeline a middleware that creates an OpenTracing span.
/// </summary>
/// <param name="pipelineBuilder">The pipeline builder.</param>
/// <returns>The pipeline builder for further configuring the pipeline. It is used used in the fluent configuration API.</returns>
public static IPipelineBuilder<MessagingContext> UseOpenTracingMiddleware(
this IPipelineBuilder<MessagingContext> pipelineBuilder)
=> UseMiddleware<OpenTracingMiddleware>(pipelineBuilder);


private static IPipelineBuilder<MessagingContext> UseMiddleware<TMiddleware>(
this IPipelineBuilder<MessagingContext> pipelineBuilder)
where TMiddleware : IPipelineMiddleware<MessagingContext>
=> pipelineBuilder.UseMiddleware<TMiddleware, MessagingContext>();
}
}
private static IPipelineBuilder<MessagingContext> UseMiddleware<TMiddleware>(
this IPipelineBuilder<MessagingContext> pipelineBuilder)
where TMiddleware : IPipelineMiddleware<MessagingContext>
=> pipelineBuilder.UseMiddleware<TMiddleware, MessagingContext>();
}

0 comments on commit 502a689

Please sign in to comment.