Skip to content

Instantly share code, notes, and snippets.

Avatar

Ali alikrc

View GitHub Profile
View request.json
{
"notificationDate": "2022-04-22T11:19:23.246Z",
"notificationMessage": "Peace at home, peace at world!",
"notificationType": 2
}
View NotificationType.cs
namespace MasstransitDemo.Shared;
public enum NotificationType
{
Email,
Push,
Sms
}
View INotificationCreated.cs
namespace MasstransitDemo.Shared;
public interface INotificationCreated
{
DateTime NotificationDate { get; }
string NotificationMessage { get; }
NotificationType NotificationType { get; }
}
View ConsumerProgram.cs
using MassTransit;
using Microsoft.Extensions.Hosting;
using System.Reflection;
var builder = Host.CreateDefaultBuilder(args);
builder.ConfigureServices((hostContext, services) =>
{
services.AddMassTransit(busConfigurator =>
{
View NotificationCreatedConsumer.cs
using MassTransit;
using MasstransitDemo.Shared;
using System.Text.Json;
namespace MasstransitDemo.Consumer;
public class NotificationCreatedConsumer : IConsumer<INotificationCreated>
{
public async Task Consume(ConsumeContext<INotificationCreated> context)
{
View NotificationDto.cs
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; }
}
View docker-compose.yml
version: '3.4'
services:
masstransitdemo.api:
image: ${DOCKER_REGISTRY-}masstransitdemoapi
build:
context: .
dockerfile: MasstransitDemo.Api/Dockerfile
ports:
- '7047:443'
View ApiProgram.cs
using MassTransit;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddMassTransit(busConfigurator =>
{
View NotificationController.cs
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
@alikrc
alikrc / DbeaverDarkThemeHow.md
Last active Feb 10, 2022
dbeaver dark theme setup
View DbeaverDarkThemeHow.md