This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MassTransit; | |
using MasstransitDemo.Api.Models; | |
using MasstransitDemo.Shared; | |
using Microsoft.AspNetCore.Mvc; | |
namespace MasstransitDemo.Api.Controllers; | |
[Route("api/[controller]")] | |
[ApiController] | |
public class NotificationController : ControllerBase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MassTransit; | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Services.AddControllers(); | |
builder.Services.AddEndpointsApiExplorer(); | |
builder.Services.AddSwaggerGen(); | |
builder.Services.AddMassTransit(busConfigurator => | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.4' | |
services: | |
masstransitdemo.api: | |
image: ${DOCKER_REGISTRY-}masstransitdemoapi | |
build: | |
context: . | |
dockerfile: MasstransitDemo.Api/Dockerfile | |
ports: | |
- '7047:443' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MasstransitDemo.Shared; | |
namespace MasstransitDemo.Api.Models | |
{ | |
public class NotificationDto | |
{ | |
public DateTime NotificationDate { get; set; } | |
public string NotificationMessage { get; set; } | |
public NotificationType NotificationType { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MassTransit; | |
using MasstransitDemo.Shared; | |
using System.Text.Json; | |
namespace MasstransitDemo.Consumer; | |
public class NotificationCreatedConsumer : IConsumer<INotificationCreated> | |
{ | |
public async Task Consume(ConsumeContext<INotificationCreated> context) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MassTransit; | |
using Microsoft.Extensions.Hosting; | |
using System.Reflection; | |
var builder = Host.CreateDefaultBuilder(args); | |
builder.ConfigureServices((hostContext, services) => | |
{ | |
services.AddMassTransit(busConfigurator => | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MasstransitDemo.Shared; | |
public interface INotificationCreated | |
{ | |
DateTime NotificationDate { get; } | |
string NotificationMessage { get; } | |
NotificationType NotificationType { get; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MasstransitDemo.Shared; | |
public enum NotificationType | |
{ | |
Email, | |
Push, | |
Sms | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"notificationDate": "2022-04-22T11:19:23.246Z", | |
"notificationMessage": "Peace at home, peace at world!", | |
"notificationType": 2 | |
} |
OlderNewer