### Start Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/IndexedDb/IndexedDbQueueProcessor Syntax for the Start method. ```csharp public System.Threading.Tasks.Task Start(System.Threading.CancellationToken cancellationToken = null) ``` -------------------------------- ### Install SimpleMessageBus for Development and Testing Source: https://easyaf.dev/simplemessagebus/installation Use these commands to install the required packages for development and testing scenarios. ```bash dotnet add package SimpleMessageBus.Publish dotnet add package SimpleMessageBus.Dispatch.FileSystem dotnet add package SimpleMessageBus.Breakdance ``` -------------------------------- ### Example Implementation of IMessage Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage Provides an example class implementing the IMessage interface with an Id property initialized to a new Guid, along with OrderNumber, TotalAmount, and CreatedAt properties. ```csharp public class OrderCreatedMessage : IMessage { public Guid Id { get; set; } = Guid.NewGuid(); public string OrderNumber { get; set; } public decimal TotalAmount { get; set; } public DateTime CreatedAt { get; set; } } ``` -------------------------------- ### Set Up Test Container with Azurite Source: https://easyaf.dev/simplemessagebus/guides/testing Starts an Azurite container for Azure Storage emulation in a test fixture. Uses AzuriteBuilder to configure the container image and starts it in OneTimeSetUp, disposing in OneTimeTearDown. ```csharp [TestFixture] public class OrderProcessingIntegrationTests { private AzuriteContainer _azuriteContainer; private IServiceProvider _serviceProvider; [OneTimeSetUp] public async Task OneTimeSetUp() { // Start Azurite container for Azure Storage emulation _azuriteContainer = new AzuriteBuilder() .WithImage("mcr.microsoft.com/azure-storage/azurite:latest") .Build(); await _azuriteContainer.StartAsync(); } [OneTimeTearDown] public async Task OneTimeTearDown() { await _azuriteContainer.DisposeAsync(); } } ``` -------------------------------- ### Set QueueName Example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Amazon/Core/AmazonSQSOptions Example of setting the QueueName property. Consider using environment-specific prefixes to avoid conflicts between environments. ```csharp options.QueueName = "myapp-messages"; // or environment-specific naming options.QueueName = $"myapp-{environment}-messages"; ``` -------------------------------- ### PublishAsync Usage Example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Breakdance/TestableMessagePublisher Demonstrates direct usage of PublishAsync and verifying the captured message. Typically called by code under test. The example shows how to assert the message was captured. ```csharp // Direct usage (though typically called by code under test) var message = new OrderCreatedMessage { OrderNumber = "ORD-001" }; await publisher.PublishAsync(message, isSystemGenerated: false); // Verify it was captured Assert.AreEqual(1, publisher.PublishedMessages.Count); Assert.AreSame(message, publisher.PublishedMessages[0]); ``` -------------------------------- ### Verify Package Installation Source: https://easyaf.dev/simplemessagebus/installation Run this command to list installed packages and verify that SimpleMessageBus packages are present with correct versions. ```bash dotnet list package ``` -------------------------------- ### Install SimpleMessageBus for Azure Storage Source: https://easyaf.dev/simplemessagebus/installation Use these commands to install the required packages for ASP.NET Core applications utilizing Azure Storage Queues. ```bash dotnet add package SimpleMessageBus.Publish.Azure dotnet add package SimpleMessageBus.Dispatch.Azure dotnet add package SimpleMessageBus.Hosting ``` -------------------------------- ### Install SimpleMessageBus for Blazor WebAssembly Source: https://easyaf.dev/simplemessagebus/installation Use these commands to install the required packages for client-side Blazor applications. ```bash dotnet add package SimpleMessageBus.Publish.IndexedDb dotnet add package SimpleMessageBus.Dispatch.IndexedDb ``` -------------------------------- ### OnNextAsync implementation example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMessageHandler Example implementation that extracts metadata and processes messages based on type, throwing NotSupportedException for unsupported types. ```csharp public async Task OnNextAsync(MessageEnvelope messageEnvelope) { // Extract metadata if available var userId = messageEnvelope.Metadata?.GetValueOrDefault("UserId"); // Process based on message type switch (messageEnvelope.Message) { case OrderCreatedMessage order: await ProcessOrderAsync(order, userId?.ToString()); break; default: throw new NotSupportedException($"Message type {messageEnvelope.Message.GetType()} not supported"); } } ``` -------------------------------- ### Install SimpleMessageBus for Azure Functions Source: https://easyaf.dev/simplemessagebus/installation Use these commands to install the required packages for Azure Functions with file system triggers. ```bash dotnet add package SimpleMessageBus.Publish dotnet add package SimpleMessageBus.Dispatch.FileSystem dotnet add package Microsoft.Azure.WebJobs.Extensions ``` -------------------------------- ### Reusable Test Fixture for Message Handlers Source: https://easyaf.dev/simplemessagebus/guides/testing Use this fixture to set up a service provider with mocked dependencies and a testable message publisher. It includes OneTimeSetUp, SetUp, and OneTimeTearDown methods, and an example test fixture that inherits from it to test an OrderCreatedHandler. ```csharp public class MessageHandlerTestFixture { public IServiceProvider ServiceProvider { get; private set; } public TestableMessagePublisher TestPublisher { get; private set; } [OneTimeSetUp] public void OneTimeSetUp() { var services = new ServiceCollection(); TestPublisher = new TestableMessagePublisher(); services.AddSingleton(TestPublisher); // Add common test services services.AddLogging(); services.AddSingleton(Mock.Of()); services.AddSingleton(Mock.Of()); services.AddSingleton(Mock.Of()); ServiceProvider = services.BuildServiceProvider(); } [SetUp] public void SetUp() { TestPublisher.Clear(); } [OneTimeTearDown] public void OneTimeTearDown() { ServiceProvider?.Dispose(); } } [TestFixture] public class OrderHandlerTests : MessageHandlerTestFixture { private OrderCreatedHandler _handler; [SetUp] public void SetUp() { base.SetUp(); _handler = new OrderCreatedHandler( ServiceProvider.GetRequiredService(), ServiceProvider.GetRequiredService>()); } [Test] public async Task ProcessOrder_CallsOrderService() { // Test implementation using inherited fixtures var message = new OrderCreatedMessage { OrderNumber = "ORD-001" }; await _handler.OnNextAsync(new MessageEnvelope(message)); // Assertions... } } ``` -------------------------------- ### Install SimpleMessageBus for Amazon SQS Source: https://easyaf.dev/simplemessagebus/installation Use these commands to install the required packages for console applications utilizing Amazon SQS. ```bash dotnet add package SimpleMessageBus.Publish.Amazon dotnet add package SimpleMessageBus.Dispatch.Amazon dotnet add package SimpleMessageBus.Hosting dotnet add package Microsoft.Extensions.Hosting ``` -------------------------------- ### Setting and Reading Metadata Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMetadataAware Example of setting metadata in a publisher and reading it in a handler. ```csharp // Setting metadata in a publisher var message = new OrderCreatedMessage { OrderNumber = "ORD-001" }; message.Metadata["UserId"] = currentUser.Id; message.Metadata["RequestId"] = Guid.NewGuid(); message.Metadata["Source"] = "WebAPI"; // Reading metadata in a handler var userId = message.Metadata.GetValueOrDefault("UserId")?.ToString(); var isFromAPI = message.Metadata.ContainsKey("Source") && message.Metadata["Source"].ToString() == "WebAPI"; ``` -------------------------------- ### Options Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessorFactoryContext Gets the FileSystemOptions configuration for the file processor. ```csharp public CloudNimble.SimpleMessageBus.Core.FileSystemOptions Options { get; private set; } ``` -------------------------------- ### CorrelationId Usage Example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/ITrackable Example showing how to start a new workflow with a new correlation ID and propagate it to subsequent messages. All related messages share the same correlation ID for correlation in logs and monitoring. ```csharp // Starting a new workflow var rootMessage = new OrderCreatedMessage { CorrelationId = Guid.NewGuid() // New workflow starts here }; // All subsequent messages inherit the same correlation ID var paymentMessage = new ProcessPaymentMessage { CorrelationId = rootMessage.CorrelationId // Same workflow }; var shippingMessage = new ArrangeShippingMessage { CorrelationId = rootMessage.CorrelationId // Same workflow }; // Now all three messages can be correlated together in logs and monitoring ``` -------------------------------- ### Install Packages via Package Manager Console Source: https://easyaf.dev/simplemessagebus/installation Use these commands in the Package Manager Console to install the necessary SimpleMessageBus packages for your chosen provider. ```powershell # Azure Storage Queue Install-Package SimpleMessageBus.Publish.Azure Install-Package SimpleMessageBus.Dispatch.Azure # Amazon SQS Install-Package SimpleMessageBus.Publish.Amazon Install-Package SimpleMessageBus.Dispatch.Amazon # File System Install-Package SimpleMessageBus.Publish Install-Package SimpleMessageBus.Dispatch.FileSystem # IndexedDB (Blazor WebAssembly) Install-Package SimpleMessageBus.Publish.IndexedDb Install-Package SimpleMessageBus.Dispatch.IndexedDb ``` -------------------------------- ### CreateChild Usage Example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage Example of creating a child event that inherits filtered parent metadata. ```csharp // Create a child event that inherits filtered parent metadata var shipmentRequested = message.CreateChild(); shipmentRequested.OrderId = message.OrderId; shipmentRequested.Items = result.Items; await publisher.PublishAsync(shipmentRequested); ``` -------------------------------- ### Install SimpleMessageBus.Dispatch.Azure Source: https://easyaf.dev/simplemessagebus/installation Adds the SimpleMessageBus.Dispatch.Azure package for processing messages from Azure Storage Queues. ```bash dotnet add package SimpleMessageBus.Dispatch.Azure ``` -------------------------------- ### Install SimpleMessageBus.Dispatch.FileSystem Source: https://easyaf.dev/simplemessagebus/installation Adds the SimpleMessageBus.Dispatch.FileSystem package for processing messages from file system storage, including Azure Functions trigger support. ```bash dotnet add package SimpleMessageBus.Dispatch.FileSystem ``` -------------------------------- ### Install SimpleMessageBus packages for File System Source: https://easyaf.dev/simplemessagebus/quickstart Use these dotnet CLI commands to add the File System publish and dispatch packages to your project. ```bash dotnet add package SimpleMessageBus.Publish dotnet add package SimpleMessageBus.Dispatch.FileSystem ``` -------------------------------- ### Install SimpleMessageBus.Publish Source: https://easyaf.dev/simplemessagebus/installation Adds the SimpleMessageBus.Publish package for basic file system-based message publishing, suitable for development and simple scenarios. ```bash dotnet add package SimpleMessageBus.Publish ``` -------------------------------- ### Install SimpleMessageBus.Dispatch.IndexedDb Source: https://easyaf.dev/simplemessagebus/installation Adds the SimpleMessageBus.Dispatch.IndexedDb package for client-side message processing using browser IndexedDB in Blazor WebAssembly. ```bash dotnet add package SimpleMessageBus.Dispatch.IndexedDb ``` -------------------------------- ### OrderMessageHandler Example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMessageHandler Example implementation of IMessageHandler that handles OrderCreatedMessage and OrderUpdatedMessage types. It uses dependency injection for IOrderService and implements GetHandledMessageTypes, OnNextAsync, and OnErrorAsync methods. ```csharp public class OrderMessageHandler : IMessageHandler { private readonly IOrderService _orderService; public OrderMessageHandler(IOrderService orderService) { _orderService = orderService; } public IEnumerable GetHandledMessageTypes() { yield return typeof(OrderCreatedMessage); yield return typeof(OrderUpdatedMessage); } public async Task OnNextAsync(MessageEnvelope messageEnvelope) { switch (messageEnvelope.Message) { case OrderCreatedMessage created: await _orderService.ProcessNewOrderAsync(created); break; case OrderUpdatedMessage updated: await _orderService.UpdateOrderAsync(updated); break; } } public async Task OnErrorAsync(IMessage message, Exception exception) { // Log the error and potentially send notifications await _orderService.HandleProcessingErrorAsync(message, exception); } } ``` -------------------------------- ### Install SimpleMessageBus.Dispatch Source: https://easyaf.dev/simplemessagebus/installation Adds the SimpleMessageBus.Dispatch package for base dispatcher functionality and interfaces. ```bash dotnet add package SimpleMessageBus.Dispatch ``` -------------------------------- ### Install SimpleMessageBus.Dispatch.Amazon Source: https://easyaf.dev/simplemessagebus/installation Adds the SimpleMessageBus.Dispatch.Amazon package for processing messages from Amazon SQS queues. ```bash dotnet add package SimpleMessageBus.Dispatch.Amazon ``` -------------------------------- ### QueueFolder Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessorFactoryContext Gets the path to the queue folder. ```csharp public string QueueFolder { get; private set; } ``` -------------------------------- ### Install SimpleMessageBus.Publish.Azure Source: https://easyaf.dev/simplemessagebus/installation Adds the SimpleMessageBus.Publish.Azure package for publishing messages to Azure Storage Queues. Depends on Azure.Storage.Queues and Microsoft.Extensions.DependencyInjection. ```bash dotnet add package SimpleMessageBus.Publish.Azure ``` -------------------------------- ### Install SimpleMessageBus packages for Azure Storage Queue Source: https://easyaf.dev/simplemessagebus/quickstart Use these dotnet CLI commands to add the Azure Storage Queue publish and dispatch packages to your project. ```bash dotnet add package SimpleMessageBus.Publish.Azure dotnet add package SimpleMessageBus.Dispatch.Azure ``` -------------------------------- ### Install SimpleMessageBus.Publish.IndexedDb Source: https://easyaf.dev/simplemessagebus/installation Adds the SimpleMessageBus.Publish.IndexedDb package for client-side message publishing using browser IndexedDB. Requires a Blazor WebAssembly project and .NET 8+ target framework. ```bash dotnet add package SimpleMessageBus.Publish.IndexedDb ``` -------------------------------- ### Install SimpleMessageBus packages for Amazon SQS Source: https://easyaf.dev/simplemessagebus/quickstart Use these dotnet CLI commands to add the Amazon SQS publish and dispatch packages to your project. ```bash dotnet add package SimpleMessageBus.Publish.Amazon dotnet add package SimpleMessageBus.Dispatch.Amazon ``` -------------------------------- ### Implementing IMetadataAware and Using Metadata in a Handler Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMetadataAware Example class implementing IMetadataAware with a ConcurrentDictionary for metadata, and a handler that reads and writes metadata. ```csharp public class OrderCreatedMessage : IMessage, IMetadataAware { public Guid Id { get; set; } = Guid.NewGuid(); public ConcurrentDictionary<string, object> Metadata { get; set; } = new(); public string OrderNumber { get; set; } public decimal Amount { get; set; } } // Usage in handler public async Task OnNextAsync(MessageEnvelope envelope) { if (envelope.Message is IMetadataAware metadataMessage) { // Read metadata set by previous handlers var userId = metadataMessage.Metadata.GetValueOrDefault("UserId"); var requestId = metadataMessage.Metadata.GetValueOrDefault("RequestId"); // Add new metadata for downstream handlers metadataMessage.Metadata["ProcessedBy"] = "OrderHandler"; metadataMessage.Metadata["ProcessedAt"] = DateTime.UtcNow; } } ``` -------------------------------- ### Install SimpleMessageBus.Publish.Amazon Source: https://easyaf.dev/simplemessagebus/installation Adds the SimpleMessageBus.Publish.Amazon package for publishing messages to Amazon SQS queues. Depends on AWSSDK.SQS and Microsoft.Extensions.DependencyInjection. ```bash dotnet add package SimpleMessageBus.Publish.Amazon ``` -------------------------------- ### Implementing Message Tracking Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/ITrackable Example showing how to initialize parent-child relationships and correlation IDs when creating messages in a workflow. ```csharp // Original message starts a workflow var orderCreated = new OrderCreatedMessage { Id = Guid.NewGuid(), CorrelationId = Guid.NewGuid(), // New workflow ParentId = null, // No parent, this is the root OrderNumber = "ORD-001" }; // Child message spawned during processing var inventoryReserved = new InventoryReservedMessage { Id = Guid.NewGuid(), CorrelationId = orderCreated.CorrelationId, // Same workflow ParentId = orderCreated.Id, // Direct child of order created ProductId = "PROD-123", Quantity = 2 }; // Another child in the same workflow var paymentProcessed = new PaymentProcessedMessage { Id = Guid.NewGuid(), CorrelationId = orderCreated.CorrelationId, // Same workflow ParentId = orderCreated.Id, // Also child of order created Amount = 99.99m }; ``` -------------------------------- ### Example assertions using PublishedMessages Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Breakdance/TestableMessagePublisher Shows how to use PublishedMessages in test assertions to verify message count, types, content, and sequence. ```csharp // Verify message count and types Assert.AreEqual(3, publisher.PublishedMessages.Count); Assert.IsTrue(publisher.PublishedMessages.Any(m => m is OrderCreatedMessage)); // Verify specific message content var orderMessage = publisher.PublishedMessages.OfType<OrderCreatedMessage>().First(); Assert.AreEqual("ORD-001", orderMessage.OrderNumber); // Verify message sequence Assert.IsInstanceOfType(publisher.PublishedMessages[0], typeof(OrderCreatedMessage)); Assert.IsInstanceOfType(publisher.PublishedMessages[1], typeof(InventoryReservedMessage)); Assert.IsInstanceOfType(publisher.PublishedMessages[2], typeof(PaymentProcessedMessage)); ``` -------------------------------- ### Validate Configuration at Startup Source: https://easyaf.dev/simplemessagebus/guides/configuration Use Data Annotations and ValidateOnStart to ensure configuration settings meet required constraints during application startup. ```csharp services.Configure( builder.Configuration.GetSection("SimpleMessageBus:Azure")); services.AddOptions() .Configure(builder.Configuration.GetSection("SimpleMessageBus:Azure")) .ValidateDataAnnotations() .ValidateOnStart(); public class AzureStorageOptions { [Required] public string ConnectionString { get; set; } [Required] [RegularExpression(@"^[a-z0-9-]+$")] public string DefaultQueueName { get; set; } [Range(1, 32)] public int MaxConcurrentMessages { get; set; } = 16; } ``` -------------------------------- ### Install SimpleMessageBus.Breakdance Source: https://easyaf.dev/simplemessagebus/installation Adds the SimpleMessageBus.Breakdance package (version 1.0.0-preview) for testing utilities and mocks used in unit testing message handlers. ```bash dotnet add package SimpleMessageBus.Breakdance --version 1.0.0-preview ``` -------------------------------- ### Mock configuration for unit tests Source: https://easyaf.dev/simplemessagebus/guides/configuration Demonstrates how to bind configuration settings to options for unit testing. ```csharp [Test] public void Configure_WithValidOptions_RegistersServices() { var services = new ServiceCollection(); var configuration = new ConfigurationBuilder() .AddInMemoryCollection(new Dictionary { ["ConnectionString"] = "UseDevelopmentStorage=true", ["DefaultQueueName"] = "test-queue" }) .Build(); services.AddSimpleMessageBusAzureStoragePublisher(options => { configuration.Bind(options); }); var provider = services.BuildServiceProvider(); var publisher = provider.GetService(); Assert.That(publisher, Is.Not.Null); } ``` -------------------------------- ### Create a message handler implementing IMessageHandler Source: https://easyaf.dev/simplemessagebus/quickstart Implement IMessageHandler to process messages. The example logs the user creation and calls a private method to simulate processing. ```csharp using SimpleMessageBus.Core; public class UserCreatedHandler : IMessageHandler { private readonly ILogger _logger; public UserCreatedHandler(ILogger logger) { _logger = logger; } public async Task HandleAsync(UserCreatedMessage message) { _logger.LogInformation("User created: {UserId} - {Email}", message.UserId, message.Email); // Process the message (send welcome email, update database, etc.) await ProcessUserCreation(message); } private async Task ProcessUserCreation(UserCreatedMessage message) { // Your business logic here await Task.Delay(100); // Simulate processing } } ``` -------------------------------- ### RootFolder Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/FileSystemOptions Gets or sets the root directory that contains the queue, completed, and error folders. ```csharp public string RootFolder { get; set; } ``` -------------------------------- ### LastRunSucceeded Usage Example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage Example demonstrating idempotent message processing using LastRunSucceeded. ```csharp public async Task Handle(OrderCreated message, ILogger logger) { if (message.LastRunSucceeded(GetType().Name)) { logger.LogInformation("Order {OrderId} already processed successfully", message.Id); return; } // Process the message... message.UpdateResult(true, GetType().Name); } ``` -------------------------------- ### Configure and use Azure Storage Queue in Program.cs Source: https://easyaf.dev/simplemessagebus/providers/azure-storage-queue This example demonstrates how to register the Azure Storage publisher and dispatcher services, register a message handler, and publish a message within an API endpoint. ```csharp // Program.cs using SimpleMessageBus.Publish.Azure.Extensions; using SimpleMessageBus.Dispatch.Azure.Extensions; var builder = WebApplication.CreateBuilder(args); // Configure Azure Storage Queue builder.Services.AddSimpleMessageBusAzureStoragePublisher(options => { options.ConnectionString = builder.Configuration.GetConnectionString("AzureStorage"); options.DefaultQueueName = "orders"; }); builder.Services.AddSimpleMessageBusAzureStorageDispatcher(options => { options.ConnectionString = builder.Configuration.GetConnectionString("AzureStorage"); options.DefaultQueueName = "orders"; options.MaxConcurrentMessages = 16; options.PollingInterval = TimeSpan.FromSeconds(2); }); // Register handlers builder.Services.AddScoped, OrderCreatedHandler>(); var app = builder.Build(); // API endpoint app.MapPost("/orders", async (CreateOrderRequest request, IMessagePublisher publisher) => { var orderId = Guid.NewGuid().ToString(); // Publish message await publisher.PublishAsync(new OrderCreatedMessage { OrderId = orderId, CustomerId = request.CustomerId, TotalAmount = request.TotalAmount, CreatedAt = DateTime.UtcNow }); return Results.Ok(new { OrderId = orderId }); }); app.Run(); ``` -------------------------------- ### Configure providers by environment Source: https://easyaf.dev/simplemessagebus/providers/overview Use the environment-based configuration pattern to register the FileSystem provider in development and the AzureStorage provider in production. ```csharp if (builder.Environment.IsDevelopment()) { builder.Services.AddSimpleMessageBusFileSystemProvider(); } else if (builder.Environment.IsProduction()) { builder.Services.AddSimpleMessageBusAzureStorageProvider(); } ``` -------------------------------- ### Constructor with path, access, and mode Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileAttribute Constructs a new instance with a file path, FileAccess, and FileMode. ```csharp public SimpleMessageBusFileAttribute(string path, System.IO.FileAccess access, System.IO.FileMode mode) ``` -------------------------------- ### Example: Creating an envelope from a message Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/MessageEnvelope Shows how to create a MessageEnvelope from an OrderCreatedMessage. The envelope's Id, DatePublished, MessageType, and MessageContent are automatically populated. ```csharp var message = new OrderCreatedMessage { OrderNumber = "ORD-001", CustomerId = customerId, TotalAmount = 99.99m }; var envelope = new MessageEnvelope(message); // envelope.Id is automatically generated // envelope.DatePublished is set to now // envelope.MessageType contains the full type name // envelope.MessageContent contains the JSON serialized message ``` -------------------------------- ### UpdateResult Usage Example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/IMessage Example of using UpdateResult to record success or failure status within a message handler. ```csharp public async Task Handle(OrderCreated message, ILogger logger) { try { await ProcessOrder(message); message.UpdateResult(true, GetType().Name); } catch (Exception ex) { logger.LogError(ex, "Failed to process order"); message.UpdateResult(false, GetType().Name); throw; } } ``` -------------------------------- ### Define a message class implementing IMessage Source: https://easyaf.dev/simplemessagebus/quickstart Create a message class that implements IMessage. The example includes properties for UserId, Email, and CreatedAt. ```csharp using SimpleMessageBus.Core; public class UserCreatedMessage : IMessage { public string UserId { get; set; } public string Email { get; set; } public DateTime CreatedAt { get; set; } } ``` -------------------------------- ### Constructor with path and access Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileAttribute Constructs a new instance with a file path and optional FileAccess (default is 1, which corresponds to FileAccess.Read). ```csharp public SimpleMessageBusFileAttribute(string path, System.IO.FileAccess access = 1) ``` -------------------------------- ### Set PoisonQueueName Example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Amazon/Core/AmazonSQSOptions Example of setting the PoisonQueueName property. This queue acts as a dead letter queue for messages that exceed retry attempts. ```csharp options.PoisonQueueName = "myapp-messages-poison"; // Configure with longer retention for investigation // Queue should be monitored for failure patterns ``` -------------------------------- ### Set CompletedQueueName Example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Amazon/Core/AmazonSQSOptions Example of setting the CompletedQueueName property. This queue is optional; if not set, successfully processed messages are deleted from the main queue. ```csharp options.CompletedQueueName = "myapp-messages-completed"; // This queue will contain messages that were successfully processed ``` -------------------------------- ### File System Basic Configuration Source: https://easyaf.dev/simplemessagebus/guides/configuration Configures the publisher and dispatcher for local file system message storage. ```csharp services.AddSimpleMessageBusFileSystemPublisher(options => { options.RootPath = @"C:\MessageQueue"; options.CreateDirectoriesAutomatically = true; }); services.AddSimpleMessageBusFileSystemDispatcher(options => { options.RootPath = @"C:\MessageQueue"; options.PollingInterval = TimeSpan.FromSeconds(1); options.ProcessedDirectory = "processed"; options.ErrorDirectory = "errors"; }); ``` -------------------------------- ### GetMessage Usage Example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/MessageEnvelope Example usage of GetMessage for type-safe deserialization when the message type is known at compile time. It deserializes the envelope's content into a strongly-typed message and processes it. ```csharp public async Task OnNextAsync(MessageEnvelope envelope) { // Type-safe deserialization when you know the expected type var orderMessage = envelope.GetMessage<OrderCreatedMessage>(); // Process the strongly-typed message await ProcessOrderAsync(orderMessage.OrderNumber, orderMessage.TotalAmount); } ``` -------------------------------- ### ParentId Usage Example Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/ITrackable Example showing how to create child messages in a message handler. Sets ParentId to the parent message's ID and inherits the CorrelationId from the parent if it implements ITrackable, otherwise generates a new one. ```csharp // In a message handler creating child messages public async Task OnNextAsync(MessageEnvelope envelope) { var parentMessage = envelope.Message; // Create child messages with proper lineage var childMessage = new ChildMessage { ParentId = parentMessage.Id, // Link to parent CorrelationId = (parentMessage as ITrackable)?.CorrelationId ?? Guid.NewGuid() }; await _publisher.PublishAsync(childMessage); } ``` -------------------------------- ### Configure multiple publishers with keyed services (C#) Source: https://easyaf.dev/simplemessagebus/providers/overview Registers both Azure Storage and FileSystem publishers under distinct keys ('primary' and 'local'). Constructor injection uses FromKeyedServices to receive the correct publisher instance per scenario. ```csharp // Configure multiple publishers services.AddSimpleMessageBusAzureStoragePublisher("primary", options => { options.ConnectionString = azureConnectionString; }); services.AddSimpleMessageBusFileSystemPublisher("local", options => { options.RootPath = localPath; }); // Use named publishers public class OrderService { private readonly IMessagePublisher _primaryPublisher; private readonly IMessagePublisher _localPublisher; public OrderService( [FromKeyedServices("primary")] IMessagePublisher primaryPublisher, [FromKeyedServices("local")] IMessagePublisher localPublisher) { _primaryPublisher = primaryPublisher; _localPublisher = localPublisher; } } ``` -------------------------------- ### Attribute Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessorFactoryContext Gets the SimpleMessageBusFileTriggerAttribute associated with the context. ```csharp public CloudNimble.SimpleMessageBus.Dispatch.Triggers.SimpleMessageBusFileTriggerAttribute Attribute { get; private set; } ``` -------------------------------- ### Publish a message with IMessagePublisher in UserController Source: https://easyaf.dev/simplemessagebus/quickstart Inject IMessagePublisher into a controller and publish a UserCreatedMessage after creating a user. The message is published asynchronously with PublishAsync. The dispatcher starts automatically when the application starts; for Azure Functions or console apps, additional configuration may be needed. ```csharp public class UserController : ControllerBase { private readonly IMessagePublisher _messagePublisher; public UserController(IMessagePublisher messagePublisher) { _messagePublisher = messagePublisher; } [HttpPost] public async Task CreateUser([FromBody] CreateUserRequest request) { // Create the user (your business logic) var userId = await CreateUserInDatabase(request); // Publish the message var message = new UserCreatedMessage { UserId = userId, Email = request.Email, CreatedAt = DateTime.UtcNow }; await _messagePublisher.PublishAsync(message); return Ok(new { UserId = userId }); } } ``` -------------------------------- ### SetAction Usage Examples Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Breakdance/TestableMessagePublisher Demonstrates configuring custom actions for the test publisher: simulating publishing failures for certain message types, simulating side effects like logging, and removing the action by setting it to null. ```csharp // Simulate publishing failures for certain message types publisher.SetAction((message, isSystem) => { if (message is CriticalMessage) throw new InvalidOperationException("Publishing service unavailable"); }); // Simulate side effects like logging or notifications publisher.SetAction((message, isSystem) => { if (isSystem) systemMessageCount++; logger.LogInformation("Published {MessageType}", message.GetType().Name); }); // Remove the action publisher.SetAction(null); ``` -------------------------------- ### Configure File System with SimpleMessageBus Source: https://easyaf.dev/simplemessagebus/quickstart Registers the File System publisher and dispatcher using a root path under the current directory. Also registers a scoped message handler. Requires the SimpleMessageBus.Publish and SimpleMessageBus.Dispatch.FileSystem packages. ```csharp using SimpleMessageBus.Publish.Extensions; using SimpleMessageBus.Dispatch.FileSystem.Extensions; var builder = WebApplication.CreateBuilder(args); // Configure File System builder.Services.AddSimpleMessageBusFileSystemPublisher(options => { options.RootPath = Path.Combine(Directory.GetCurrentDirectory(), "messages"); }); builder.Services.AddSimpleMessageBusFileSystemDispatcher(options => { options.RootPath = Path.Combine(Directory.GetCurrentDirectory(), "messages"); }); // Register your message handler builder.Services.AddScoped, UserCreatedHandler>(); var app = builder.Build(); ``` -------------------------------- ### SimpleMessageBusFileTriggerAttribute.Filter Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileTriggerAttribute Gets the optional file filter that will be used. ```APIDOC ## SimpleMessageBusFileTriggerAttribute.Filter Property ### Description Gets the optional file filter that will be used. ### Syntax ```csharp public string Filter { get; private set; } ``` ### Property Value Type: `string` ``` -------------------------------- ### SimpleMessageBusFileTriggerAttribute.ChangeTypes Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileTriggerAttribute Gets the WatcherChangeTypes that will be used by the file watcher. ```APIDOC ## SimpleMessageBusFileTriggerAttribute.ChangeTypes Property ### Description Gets the WatcherChangeTypes that will be used by the file watcher. ### Syntax ```csharp public System.IO.WatcherChangeTypes ChangeTypes { get; private set; } ``` ### Property Value Type: `System.IO.WatcherChangeTypes` ``` -------------------------------- ### Organize Configuration in appsettings.json Source: https://easyaf.dev/simplemessagebus/guides/configuration Structure your message bus settings using dedicated sections for different providers like Azure and Amazon. ```json { "SimpleMessageBus": { "Azure": { "ConnectionString": "DefaultEndpointsProtocol=https;...", "DefaultQueueName": "messages", "MaxConcurrentMessages": 32, "PollingInterval": "00:00:05" }, "Amazon": { "Region": "us-east-1", "DefaultQueueName": "messages", "UseFifoQueues": false, "WaitTimeSeconds": 20 } } } ``` -------------------------------- ### Logger Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessorFactoryContext Gets the ILogger instance for logging purposes. ```csharp public Microsoft.Extensions.Logging.ILogger Logger { get; private set; } ``` -------------------------------- ### Executor Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileProcessorFactoryContext Gets the function executor for the triggered function. ```csharp public Microsoft.Azure.WebJobs.Host.Executors.ITriggeredFunctionExecutor Executor { get; private set; } ``` -------------------------------- ### ParentId Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/MessageBase Gets or sets the identifier of the parent message, if any. ```APIDOC ## ParentId Property ### Description Gets or sets the identifier of the parent message, if any. ### Syntax ```csharp public System.Nullable ParentId { get; set; } ``` ### Property Value Type: `System.Nullable` ``` -------------------------------- ### NodeInteropProvider Example: Creating Root and Child Messages Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/MessageBase Demonstrates inheriting from MessageBase to create a simple message type, creating a root message instance, and creating a child message with its parent passed to the constructor to properly set ParentId and CorrelationId lineage. ```csharp // Simple message inheriting from MessageBase public class OrderCreatedMessage : MessageBase { public string OrderNumber { get; set; } public decimal TotalAmount { get; set; } public DateTime CreatedAt { get; set; } } // Creating a root message var orderMessage = new OrderCreatedMessage { OrderNumber = "ORD-001", TotalAmount = 99.99m, CreatedAt = DateTime.UtcNow }; // Creating a child message with proper lineage public class PaymentProcessedMessage : MessageBase { public decimal Amount { get; set; } public string PaymentMethod { get; set; } public PaymentProcessedMessage(IMessage parent) : base(parent) { // Child-specific initialization } } var paymentMessage = new PaymentProcessedMessage(orderMessage) { Amount = 99.99m, PaymentMethod = "CreditCard" }; // paymentMessage.ParentId == orderMessage.Id // paymentMessage.CorrelationId == orderMessage.CorrelationId ``` -------------------------------- ### GetType Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Breakdance/TestableMessagePublisher Gets the type of the current instance. Inherited from object. ```APIDOC ## GetType ### Description Gets the type of the current instance. Inherited from object. ### Syntax ```csharp public System.Type GetType() ``` ### Returns Type: `System.Type` ``` -------------------------------- ### Id Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/MessageBase Gets or sets the unique identifier for the message. ```APIDOC ## Id Property ### Description Gets or sets the unique identifier for the message. ### Syntax ```csharp public System.Guid Id { get; set; } ``` ### Property Value Type: `System.Guid` ``` -------------------------------- ### Configure integration tests Source: https://easyaf.dev/simplemessagebus/guides/configuration Shows how to configure services for integration testing using either an in-memory provider or Azure Storage. ```csharp public class TestStartup { public void ConfigureServices(IServiceCollection services) { // Use in-memory provider for tests services.AddSimpleMessageBusInMemoryProvider(); // Or use test containers services.AddSimpleMessageBusAzureStoragePublisher(options => { options.ConnectionString = "UseDevelopmentStorage=true"; }); } } ``` -------------------------------- ### GetType() Method Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/MessageBase Gets the type of the current instance. Inherited from object. ```APIDOC ## GetType() Method ### Description Gets the type of the current instance. Inherited from object. ### Syntax ```csharp public System.Type GetType() ``` ### Parameters None. ### Returns Type: `System.Type` ``` -------------------------------- ### ChangeTypes Property Syntax Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileTriggerAttribute Gets the WatcherChangeTypes used by the file watcher. ```csharp public System.IO.WatcherChangeTypes ChangeTypes { get; private set; } ``` -------------------------------- ### Configure Amazon SQS FIFO publisher and dispatcher in Program.cs Source: https://easyaf.dev/simplemessagebus/providers/amazon-sqs Complete Program.cs setup for publishing and dispatching messages via Amazon SQS with FIFO queue and dead-letter queue. Configure publisher and dispatcher options, register a message handler, and expose an HTTP endpoint that publishes an OrderCreatedMessage. ```csharp // Program.cs using SimpleMessageBus.Publish.Amazon.Extensions; using SimpleMessageBus.Dispatch.Amazon.Extensions; var builder = WebApplication.CreateBuilder(args); // Configure Amazon SQS with FIFO queue builder.Services.AddSimpleMessageBusAmazonSQSPublisher(options => { options.Region = "us-east-1"; options.UseInstanceProfile = true; // Use IAM role options.DefaultQueueName = "orders.fifo"; options.UseFifoQueues = true; options.MessageGroupId = "order-processing"; }); builder.Services.AddSimpleMessageBusAmazonSQSDispatcher(options => { options.Region = "us-east-1"; options.UseInstanceProfile = true; options.DefaultQueueName = "orders.fifo"; options.UseFifoQueues = true; options.EnableDeadLetterQueue = true; options.MaxDeliveryCount = 3; options.WaitTimeSeconds = 20; // Long polling options.MaxConcurrentMessages = 10; }); // Register handlers builder.Services.AddScoped, OrderCreatedHandler>(); var app = builder.Build(); // API endpoint app.MapPost("/orders", async (CreateOrderRequest request, IMessagePublisher publisher) => { var orderId = Guid.NewGuid().ToString(); await publisher.PublishAsync(new OrderCreatedMessage { OrderId = orderId, CustomerId = request.CustomerId, TotalAmount = request.TotalAmount, CreatedAt = DateTime.UtcNow }); return Results.Ok(new { OrderId = orderId }); }); app.Run(); ``` -------------------------------- ### MessageBase ParentId Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/MessageBase Gets or sets the identifier of the parent message, if any. ```csharp public System.Nullable ParentId { get; set; } ``` -------------------------------- ### QueueFolderPath Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/FileSystemOptions Gets the folder path where items wait to be processed. ```csharp public string QueueFolderPath { get; } ``` -------------------------------- ### MessageBase Id Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/MessageBase Gets or sets the unique identifier for the message. ```csharp public System.Guid Id { get; set; } ``` -------------------------------- ### MessageBase CorrelationId Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/MessageBase Gets or sets the correlation identifier for the message. ```csharp public System.Guid CorrelationId { get; set; } ``` -------------------------------- ### Azure Function Startup Configuration Source: https://easyaf.dev/simplemessagebus/providers/azure-storage-queue Configures the Azure Storage dispatcher and registers message handlers within the FunctionsStartup class. ```csharp [assembly: FunctionsStartup(typeof(Startup))] public class Startup : FunctionsStartup { public override void Configure(IFunctionsHostBuilder builder) { builder.Services.AddSimpleMessageBusAzureStorageDispatcher(options => { options.ConnectionString = Environment.GetEnvironmentVariable("AzureWebJobsStorage"); }); // Register message handlers builder.Services.AddScoped, OrderHandler>(); } } ``` -------------------------------- ### Configure providers by feature flag Source: https://easyaf.dev/simplemessagebus/providers/overview Use a configuration value to toggle between the AmazonSQS provider and the AzureStorage provider. ```csharp var useAmazonSQS = builder.Configuration.GetValue("Features:UseAmazonSQS"); if (useAmazonSQS) { builder.Services.AddSimpleMessageBusAmazonSQSProvider(); } else { builder.Services.AddSimpleMessageBusAzureStorageProvider(); } ``` -------------------------------- ### SimpleMessageBusFileTriggerAttribute.RootPath Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileTriggerAttribute Gets the root path that this trigger is configured to watch for files on. ```APIDOC ## SimpleMessageBusFileTriggerAttribute.RootPath Property ### Description Gets the root path that this trigger is configured to watch for files on. ### Syntax ```csharp public string RootPath { get; } ``` ### Property Value Type: `string` ``` -------------------------------- ### Define Environment-Specific Settings Source: https://easyaf.dev/simplemessagebus/guides/configuration Use separate configuration files like appsettings.Development.json and appsettings.Production.json to manage provider-specific settings per environment. ```json // appsettings.Development.json { "SimpleMessageBus": { "Provider": "FileSystem", "FileSystem": { "RootPath": "./dev-messages", "PollingInterval": "00:00:01" } } } // appsettings.Production.json { "SimpleMessageBus": { "Provider": "AmazonSQS", "Amazon": { "Region": "us-east-1", "UseInstanceProfile": true, "WaitTimeSeconds": 20 } } } ``` -------------------------------- ### SimpleMessageBusFileTriggerAttribute.Path Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileTriggerAttribute Gets the root path that this trigger is configured to watch for files on. ```APIDOC ## SimpleMessageBusFileTriggerAttribute.Path Property ### Description Gets the root path that this trigger is configured to watch for files on. ### Syntax ```csharp public string Path { get; private set; } ``` ### Property Value Type: `string` ``` -------------------------------- ### Path property syntax Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileAttribute Gets the file path. The property has a private setter. ```csharp public string Path { get; private set; } ``` -------------------------------- ### Filter Property Syntax Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileTriggerAttribute Gets the optional file filter used by the trigger. ```csharp public string Filter { get; private set; } ``` -------------------------------- ### Development Storage Emulator Configuration Source: https://easyaf.dev/simplemessagebus/providers/azure-storage-queue Use this connection string format for local development with Azurite. ```json { "ConnectionStrings": { "AzureStorage": "UseDevelopmentStorage=true" } } ``` -------------------------------- ### Mode property syntax Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileAttribute Gets the FileMode to use. The property has a private setter. ```csharp public System.IO.FileMode Mode { get; private set; } ``` -------------------------------- ### X-Ray Tracing with TracingOrderHandler Source: https://easyaf.dev/simplemessagebus/providers/amazon-sqs Enable AWS X-Ray tracing by registering the service, then use the handler to create a subsegment, add annotations and metadata, and record exceptions on failure. The handler rethrows exceptions after adding error annotations. ```csharp builder.Services.AddAWSXRayTracing(); ``` ```csharp public class TracingOrderHandler : IMessageHandler { public async Task HandleAsync(OrderMessage message) { using var segment = AWSXRayRecorder.Instance.BeginSubsegment("ProcessOrder"); segment.AddAnnotation("OrderId", message.OrderId); segment.AddMetadata("Order", message); try { await ProcessOrder(message); segment.AddAnnotation("Status", "Success"); } catch (Exception ex) { segment.AddException(ex); segment.AddAnnotation("Status", "Error"); throw; } } } ``` -------------------------------- ### Access property syntax Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileAttribute Gets the FileAccess to use. The property has a private setter. ```csharp public System.IO.FileAccess Access { get; private set; } ``` -------------------------------- ### Configure Services for Test Container Source: https://easyaf.dev/simplemessagebus/guides/testing Configures SimpleMessageBus to use the test container's connection string. Sets up Azure Storage publisher and dispatcher with a test queue name and a short polling interval, and registers test services. ```csharp [SetUp] public void SetUp() { var services = new ServiceCollection(); // Configure SimpleMessageBus with test container services.AddSimpleMessageBusAzureStoragePublisher(options => { options.ConnectionString = _azuriteContainer.GetConnectionString(); options.DefaultQueueName = "test-orders"; }); services.AddSimpleMessageBusAzureStorageDispatcher(options => { options.ConnectionString = _azuriteContainer.GetConnectionString(); options.DefaultQueueName = "test-orders"; options.PollingInterval = TimeSpan.FromMilliseconds(100); }); // Register test services services.AddScoped(); services.AddSingleton(); services.AddLogging(); _serviceProvider = services.BuildServiceProvider(); } ``` -------------------------------- ### Azure Storage Queue Basic Configuration Source: https://easyaf.dev/simplemessagebus/guides/configuration Configures the publisher and dispatcher for Azure Storage Queues using a connection string. ```csharp services.AddSimpleMessageBusAzureStoragePublisher(options => { options.ConnectionString = "DefaultEndpointsProtocol=https;AccountName=..."; options.DefaultQueueName = "messages"; options.CreateQueuesAutomatically = true; }); services.AddSimpleMessageBusAzureStorageDispatcher(options => { options.ConnectionString = "DefaultEndpointsProtocol=https;AccountName=..."; options.DefaultQueueName = "messages"; options.PollingInterval = TimeSpan.FromSeconds(5); options.MaxConcurrentMessages = 32; options.VisibilityTimeout = TimeSpan.FromMinutes(5); }); ``` -------------------------------- ### RootPath Property Syntax Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Dispatch/Triggers/SimpleMessageBusFileTriggerAttribute Gets the root path that this trigger is configured to watch for files on. ```csharp public string RootPath { get; } ``` -------------------------------- ### ErrorFolderPath Property Source: https://easyaf.dev/simplemessagebus/api-reference/CloudNimble/SimpleMessageBus/Core/FileSystemOptions Gets the folder path where failed items are stored for analysis and reprocessing. ```csharp public string ErrorFolderPath { get; } ``` -------------------------------- ### Restore Packages Source: https://easyaf.dev/simplemessagebus/installation Run this command to restore dependencies if you encounter missing assembly errors. ```bash dotnet restore ```