Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Fast multi-transport messaging framework

License

NotificationsYou must be signed in to change notification settings

BookBeat/knightbus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build statusNuGetDocumentation Status

KnightBus is a fast, lightweight and extensible messaging framework that supports multiple active message transports

Find the official KnightBus documentation here

KnightBus Logo

Transports

PackageNuGet
KnightBus.Azure.ServiceBusKnightBus.Azure.ServiceBus
KnightBus.Azure.ServiceBus.MessagesKnightBus.Azure.ServiceBus.Messages
KnightBus.Azure.ServiceBus.ManagementKnightBus.Azure.ServiceBus.Management
KnightBus.Azure.StorageKnightBus.Azure.Storage
KnightBus.Azure.Storage.ManagementKnightBus.Azure.Storage.Management
KnightBus.Azure.Storage.MessagesKnightBus.Azure.Storage.Messages
KnightBus.RedisKnightBus.Redis
KnightBus.Redis.MessagesKnightBus.Redis.Messages
KnightBus.NatsKnightBus.Nats
KnightBus.Nats.MessagesKnightBus.Nats.Messages
KnightBus.PostgreSqlKnightBus.PostgreSql
KnightBus.PostgreSql.MessagesKnightBus.PostgreSql.Messages
KnightBus.PostgreSql.ManagementKnightBus.PostgreSql.Management

Monitoring

PackageNuGet
KnightBus.ApplicationInsightsKnightBus.ApplicationInsights
KnightBus.NewRelicKnightBus.NewRelic

Serialization

PackageNuGet
KnightBus.ProtobufNetKnightBus.ProtobufNet
KnightBus.NewtonsoftKnightBus.Newtonsoft
KnightBus.MessagePackKnightBus.MessagePack

Framework

PackageNuGet
KnightBus.HostKnightBus.Host
KnightBus.CoreKnightBus.Core
KnightBus.Core.ManagementKnightBus.Core.Management
KnightBus.MessagesKnightBus.Messages
KnightBus.SqlServerKnightBus.SqlServer
KnightBus.ScheduleKnightBus.Schedule

Message Processing

publicclassCommandProcessor:IProcessCommand<SampleCommand,SampleSettings>,{publicCommandProcessor(ISomeDependencydependency){//You can use your own container for dependency injection}publicTaskProcessAsync(SampleCommandmessage,CancellationTokencancellationToken){//Your code goes herereturnTask.CompletedTask;}}

Initialization

classProgram{staticasyncTaskMain(string[]args){varhost=Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args).ConfigureServices(services=>{//Multiple active transportsservices.UseServiceBus(config=>config.ConnectionString="sb-connection").UseTransport<ServiceBusTransport>().UseBlobStorage(config=>config.ConnectionString="storage-connection").UseTransport<StorageTransport>().RegisterProcessors();}).UseKnightBus().Build();awaithost.StartAsync(CancellationToken.None);}}

Bring your own Middleware

KnightBus supports inserting your own middleware into the execution pipeline.

publicclassCustomThrottlingMiddleware:IMessageProcessorMiddleware{privatereadonlySemaphoreQueue_semaphoreQueue;publicintCurrentCount=>_semaphoreQueue.CurrentCount;publicCustomThrottlingMiddleware(intmaxConcurrent){_semaphoreQueue=newSemaphoreQueue(maxConcurrent);}publicasyncTaskProcessAsync<T>(IMessageStateHandler<T>messageStateHandler,IPipelineInformationpipelineInformation,IMessageProcessornext,CancellationTokencancellationToken)whereT:class,IMessage{try{await_semaphoreQueue.WaitAsync().ConfigureAwait(false);awaitnext.ProcessAsync(messageStateHandler,cancellationToken).ConfigureAwait(false);}finally{_semaphoreQueue.Release();}}}

Write your own Plugin

KnightBus supports custom plugins. Examples of existing plugins are: TcpAliveListener (K8S liveness probes) and Scheduling (Chron triggers).

publicclassCustomPlugin:IPlugin{publicCustomPlugin(ISomeDependencydependency,ILogger<CustomPlugin>logger){}publicasyncTaskStartAsync(CancellationTokencancellationToken){// Start the plugin}}

Documentation

To get documentation up and running locally, do the following.

  1. Installsphinx:https://www.sphinx-doc.org
  2. Installsphinx_rtd_theme:https://github.com/readthedocs/sphinx_rtd_theme
  3. Runmake html source build in the documentation folder
  4. Opendocumentation/build/html/index.html in a browser to preview your changes

For Linux:

#In documentation folder:$sudo apt install python3 python3-sphinx python3-pip$python3 -m pip install sphinx-rtd-theme$make htmlsource build$sensible-browser build/html/index.html

[8]ページ先頭

©2009-2025 Movatter.jp