Giter Club home page Giter Club logo

openmessage's Introduction

Hi there 👋

I'm Stu, it's a pleasure to e-meet you! I'm a principal software engineer helping start ups grow utilizing .NET Core and high-quality, performant micro-services based on AWS. I mainly work on a variety of projects, including testing out new technologies, performance & scalability, streamlining product teams and general devops stuff.

  • 🌱 AWS Certified Solutions Architect Associate & AWS Certified Developer Associate
  • 📫 You can watch my YouTube videos all on things .NET, contact me on Twitter and read a few entries on my blog
  • 🔭 I’m currently working on build out Project Keas - a systemm for cloud event automation

Recent YouTube videos

Recent Blog Posts

  • Using The Factory Design Pattern in .NET The Factory Design pattern is a popular technique for creating objects in .NET applications. It allows developers to create objects without specifying the exact class of object that will be created, making it an excellent option for improving code flexibility and maintainability. This article will explore the concept behind the Factory Design pattern, its benefits, and how it can be implemented in C# code. What is the Factory Design Pattern? The Factory Design pattern is a creational pattern that provides an interface for creating objects in a superclass while allowing subclasses to alter the type of objects created.
  • Using The Decorator Design Pattern in .NET The Decorator design pattern is a widely-used technique for extending the functionality of an existing object or component. By wrapping an object in a series of decorators, you can add new behaviours, features, or properties without modifying the underlying code. This makes it a powerful and flexible way to customize and extend software systems. In .NET, the Decorator design pattern can be used in various ways to enhance and modify existing classes and components, which can help you write more maintainable, extensible, and flexible code.
  • Using The Singleton Design Pattern in .NET As a .NET developer, you understand the importance of writing efficient, scalable, and maintainable code. One design pattern that can help achieve these goals is the Singleton pattern. The Singleton pattern is a creational pattern that ensures only one instance of a class is created and provides global access to that instance throughout the application. In this blog post, we’ll look in-depth at the Singleton pattern, exploring its benefits, use cases, and implementation in C#.
  • Observed No. 12 - Removing Pre-Commit Dependencies With Docker Welcome to the 12th edition of Observed! The newsletter delivers a tip you can implement across many categories like AWS, Terraform and General DevOps practices in your infrastructure. This week’s edition looks how we can use Precommit with existing docker images. What is Pre-Commit? Pre-commit is a tool that helps developers to ensure that the code they commit is consistent with the project’s guidelines and standards. This framework allows developers to define a set of hooks or scripts to run before a commit is made to a Git repository.
  • Observed No. 11 - Saving Costs on AWS Welcome to the 11th edition of Observed! The newsletter delivers a tip you can implement across many categories like AWS, Terraform and General DevOps practices in your infrastructure. This week’s edition looks at AWS Cost Savings. Every company seems to be cutting costs in one way or another. Let’s look at different ways you can visualize and reduce costs. AWS Cost Explorer AWS Cost Explorer should be your first stop when analyzing costs.

openmessage's People

Contributors

dependabot-preview[bot] avatar im5tu avatar regis-duhirwe-cko avatar scott-ngan-cko avatar stuart-blackler-cko avatar yumahayomaso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

openmessage's Issues

Create Samples

Need some sample projects for the following:

  • Multiple Serializers
  • Azure Service Bus
  • Azure Event Hubs
  • Protobuf Serializer
  • In Memory Channel
  • Service Fabric Queue

Middleware should be able to be added to the beginning of a pipeline

For testing purposes, it is handy to insert middleware at the beginning of a pipeline. At the moment we only support adding to the end

public IPipelineBuilder<T> Use(Func<PipelineDelegate.SingleMiddleware<T>, PipelineDelegate.SingleMiddleware<T>> middleware)

We should consider an extension in the testing package to allow insert middleware at the beginning (or anywhere in the existing pipeline)

MessagePump retry behavior should be configurable

Message pump retry behaviour should be configurable. At the moment it performs an immediate retry in a while loop which causes the pump to hammer the service if it is not available:

protected override async Task ExecuteAsync(CancellationToken cancellationToken)
{
while (!cancellationToken.IsCancellationRequested)
try
{
var messages = await _sqsConsumer.ConsumeAsync(cancellationToken);
if (messages.Count == 0)
continue;
foreach (var message in messages)
await ChannelWriter.WriteAsync(message, cancellationToken);
}
catch (QueueDoesNotExistException queueException)
{
await HandleMissingQueue(queueException, cancellationToken);
}
catch (AmazonSQSException sqsException) when (sqsException.ErrorCode == "AWS.SimpleQueueService.NonExistentQueue")
{
await HandleMissingQueue(sqsException, cancellationToken);
}
catch (TaskCanceledException) { }
catch (Exception ex)
{
Logger.LogError(ex, ex.Message);
}
}

The behaviour may need to be lifted up into MessagePump<T> and should ideally make use of polly policies

ConfigureAllHandlers isn't discovering handlers when running as a unit test

assembliesToScan = new[] {Assembly.GetEntryAssembly()};

In a unit test, when running .ConfigureAllHandlers(), then IHandler<> types are not found because the entry assembly is the test host:

testhost, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

We should consider using a different assembly (Assembly.GetExecutingAssembly()) or take in a specific class .ConfigureAllHandlers<Program>()

Log queue name

Logging the name of the queue that cannot be found would be super helpful in troubleshooting the error. Currently we get the below error

fail: OpenMessage.AWS.SQS.SqsMessagePump[0]
      AWS.SimpleQueueService.NonExistentQueue; see the SQS docs.
Amazon.SQS.AmazonSQSException: AWS.SimpleQueueService.NonExistentQueue; see the SQS docs.

If the deserialized type can't be found should we deserialize to the base type?

Given we are dispatching a type Person

IDispatcher<Person> personDispatcher = GetDispatcher();

But my service code publishes an internal derived type PersonWithProperties

private class PersonWithProperties : ISupportProperties { }

await personDispatcher .DispatchAsync(new PersonWithProperties())

Then PersonHandler is unable to deserialize the type to PersonWithProperties because it is private to the dispatcher code:

image

In this case, where we cant find the type of the message, should we deserialize it to the handler type (Person) instead?

SNS -> SQS Messaging Issue

When you dispatch a message to SQS, then it will automatically wrap the message like this:

{
    "MessageId": "23bfcdfd-ebfb-4402-8fa3-6d4289c3ec29",
    "ReceiptHandle": "23bfcdfd-ebfb-4402-8fa3-6d4289c3ec29#d71f87d5-a09f-4dbe-8a5d-c7c0fcbe65e3",
    "MD5OfBody": "33ef45e587fd5b08bdbc3d802b494f27",
    "Body": "{\"Property\": null}"
}

When you dispatch a message to SNS, then it will automatically wrap the message like this:

{
    "MessageId": "23bfcdfd-ebfb-4402-8fa3-6d4289c3ec29",
    "Type": "Notification",
    "Timestamp": "2019-12-12T17:56:40.209374Z",
    "Message": "{\"Property\": null}"
}

However, when you have an SQS that is subscribed to an SNS then it will wrap the message twice:

{
    "MessageId": "23bfcdfd-ebfb-4402-8fa3-6d4289c3ec29",
    "ReceiptHandle": "23bfcdfd-ebfb-4402-8fa3-6d4289c3ec29#d71f87d5-a09f-4dbe-8a5d-c7c0fcbe65e3",
    "MD5OfBody": "33ef45e587fd5b08bdbc3d802b494f27",
    "Body": "{\"MessageId\": \"c690b2be-2513-4cce-bb9d-ad7a4bf60db6\", \"Type\": \"Notification\", \"Timestamp\": \"2019-12-12T17:34:31.218142Z\", \"Message\":\"\\\"Property\\\":null\" }"
}

Should we automatically un-wrap these messages?

There will be a slight performance hit where we will need to parse the message first to work out if it is wrapped. There is also a chance that we attempt to unwrap a message that 'looks' like the wrapper

There is an issue with MessageAttributes being 'lost'

The SNS message attributes are not automatically pulled over to SQS. This means that any kind of correlation will not flow through the system nicely

Log on dispatch/consume

private static readonly Action<ILogger, string, Exception> _onMessageDispatched;
private readonly ILogger _logger;

async DispatchAsync(Message<T> entity, ...)
{
     if (_logger.IsEnabled(LogLevel.Debug))
           _onMessageDispatched(logger, message.id, null);
}

[WIP Plan] Version 1.0.0

It's been a long while since this project got any love, so it's time to embark on a big upgrade of the components to modern thinking.

Design

  • Each provider will be constructed as a unique hosted service;
  • Each provider publishes a new Message type to a central channel, simplifying the current design;
  • Consumer of the new Message type will have standardised extension points and
  • Message type:
    • Abstract by design so that consumers can register capabilities, eg: INegativelyAck, IDeferable etc.

Providers

Since the original use case for the library existing has moved on. It's worth taking a look at newer providers and getting them into the ecosystem.

  • Apache Kafka #21 (NEW!)
  • AWS SQS #23 (NEW!)
  • AWS SNS (NEW!)
  • AWS Kinesis (NEW!)
  • AWS EventBridge (NEW!)
  • Azure Event Hubs #27
  • Azure Service Bus #28
  • InMemory
  • NATS #25 (NEW!)
  • RabbitMq #22 (NEW!)

Serializers

The serializers are massively out of date and could do with an upgrade. Provide integrations for the following:

  • Hyperion (NEW!)
  • Jil
  • JsonDotNet
  • MessagePack (NEW!)
  • MsgPack (NEW!)
  • Protobuf (NEW!)
  • ServiceStackJson (NEW!)
  • Utf8Json (NEW!)
  • Wire (NEW!)

Create IBrokerHost

As part of the samples, I realised that we will end up doing a lot of the following:

services.GetRequiredService<IEnumerable<IBroker>>();

and having to self manage the disposal. Need to come up with a better pattern for this eg:

interface IBrokerHost : IDisposable {}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.