Code Monkey home page Code Monkey logo

azureservicebus.restsdk's Introduction

Project .NET Legacy Integration with Service Bus via REST

Description

This project addresses the unique challenge of integrating a legacy application, developed over 17 years ago, with modern service bus architectures using RESTful APIs. The application is built on an older version of the .NET framework, which lacks support from some contemporary libraries. This integration facilitates seamless communication between the legacy system and newer service bus technologies, ensuring continued functionality and compatibility in a changing technological landscape.

Features

  • Integration with service bus using RESTful APIs.
  • Compatibility with older .NET framework versions.
  • Seamless communication between legacy applications and modern service infrastructure.
  • Robust error handling and logging for easier maintenance.

Getting Started

Dependencies

  • .NET Framework (net 3.0 or higher)

Sdk Features

Features Status
Topics and subscription
Batch
Duplicate Detection
Scheduled Delivery
Filters and Actions
Namespaces
Senders
Receivers
Logs

Examples

src/Doc
using System;
using System.Collections.Generic;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

using AzureServiceBus.RestSDK.Core;
using AzureServiceBus.RestSDK.Template;
using AzureServiceBus.RestSDK.Core.Interface;

namespace AzureServiceBus.RestSDK.Doc
{
    internal class DemoServiceBusIntegration
    {
        protected readonly IAzureServiceBusFactory Factory;

        public DemoServiceBusIntegration()
        {
            Factory = AzureServiceBusFactory
                   .CreateNew()
                   .WithNamespace("")
                   .WithAuthorization("", "");
        }

        public AzureServiceBusTry<Exception, string> OnCreate(DemoTemplate template)
        {
            return Factory
                   .WithTopic(new AzureServiceBusTopic("topic", new AzureServiceBusMessage(ToJson(template), filter: new Dictionary<string, string> { { "status", "create" } })))
                   .Build()
                   .Send();
        }

        public AzureServiceBusTry<Exception, string> OnUpdate(DemoTemplate template, int hashCode)
        {
            if (CreateHashCode(template) == hashCode)
            {
                return string.Empty;
            }

            return Factory
                   .WithTopic(new AzureServiceBusTopic("topic", new AzureServiceBusMessage(ToJson(template), filter: new Dictionary<string, string> { { "status", "update" } })))
                   .Build()
                   .Send();
        }

        static string ToJson<T>(T value)
        {
            return JsonConvert.SerializeObject(new AzureServiceBusTemplateBase<T>("my_app", value), Formatting.Indented);
        }

        public int CreateHashCode<T>(T value)
        {
            var token = JToken.FromObject(value);
            var comparer = new JTokenEqualityComparer();
            return comparer.GetHashCode(token);
        }
    }
}

azureservicebus.restsdk's People

Contributors

julianosaless avatar

Watchers

 avatar

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.