GithubHelp home page GithubHelp logo

xcomponent / reactivexcomponent.net Goto Github PK

View Code? Open in Web Editor NEW
5.0 10.0 0.0 3.57 MB

C# API for XComponent

License: Apache License 2.0

C# 93.31% Smalltalk 0.49% PowerShell 1.67% Shell 4.00% Batchfile 0.15% Dockerfile 0.39%
nuget xcomponent dotnet-api reactive reactive-programming

reactivexcomponent.net's People

Contributors

anouarhassine avatar fle-bach avatar fredericcarre avatar julien-molina avatar maurelio1234 avatar yahyanajar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reactivexcomponent.net's Issues

Implement new XComponent header formats

Header objects for RabbitMq and Websocket have changed in the XComponent version 5. Need to make the proper changes so the Api can communicate with that version.

Implement embedded mode

XComponent components can be used in embedded mode (as a library). Need to implement that mode for the Reactive Api.

Add Custom serializer layer

Like the default client Api natively provided by XComponent, it could be necessary to include a custom serializer layer in the reactivexcomponent api.

Send Event Fails

API deosn't send the right data to trigger a transition.

  • Wrong Topic
  • Wrong EventCode

Add a filter on the GetSnapshot method

The XComponent Runtime supports natively lambda expressions to filter state machines instances according their public members properties. The idea of this feature is to extend the GetSnapshot method to add this lambda expression.

Example:

Imagine a public member with the property "Id".
We want all state machines matching a specific Id:
myComponentStm.GetSnapshot("Id == 1234")

The filter can be checked with the following code:
public static void CheckFilter(string filter) where T : class
{
try
{
var dynamicExpression = System.Linq.Dynamic.DynamicExpression.ParseLambda(new[] { Expression.Parameter(typeof(T)) }, typeof(bool), filter, new object[0]);
dynamicExpression.Compile();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}

Enhance the way we get a typed message

It's possible to cast the received message to a type using MessageEventArgs.GetMessage(). But that method expects the serialization type as a parameter. The Api should be able to use the right serialization type on its own as it is initialized with an xcApi file and that file contains the info about serialization.

Add listener for errors

For example, using RabbitMQ, when deserialization fails (e.g. if the class of the object is unknown) the exception is not reported in any way by the API.

Add a handler/listener so that users can be told when something wrong happens.

Create XComponentAPI foundation

Create the foundation of our API:

  • XComponentAPI
  • XCSession
  • XCConnection
  • XCPublisher

(no specific implementation such as rabbitmq)
It's just the first step to show how it should work.

Merge dependencies with IlRepack

Internalize dependencies with IlRepack (RabbitMq, JSON...) This way, the package will be easiest to integrate in client applications.

Add support of anonymous types in GetMessage

Add the possibility to decode a message from an anonymous type.
JsonConvert.DeserializeAnonymousType method can be used.

Please look at the example below:

subscriber.Subscribe("MyComponent", args =>
{
var anonymousType = new
{
Type = string.Empty,
Status = string.Empty,
Enabled = false,
Message = string.Empty,
};
var myType = args.GetMessage(anonymousType);
if (myType != null)
{
}
});

Add the ErrorMessage field to StateMachineRefHeader

This is an update that must be done following the implementation of the built-in error state in XComponent. If an unhandled exception occurs in a triggered method the following sequence happens:

  • The state is set to a built-in error state with a known code
  • The exception message is provided in an ErrorMessage field
  • The instance is disposed in the engine

Issue when disposing Rabbit Mq channel for private topic

This might have emerged after migrating to a newer version of RabbitMq.Client library.
The problem is that, in Rabbit Mq Subscriber, each handler is sending an acknowledgement to the bus regardless of whether the message received is intended for that handler or not. This scenario only occurs for private topic subscription as all private state machines updates are published in the same (private) channel.
Rabbit Mq seems to close the channel if an extra aknowledgement is received. And the current implementation of channels disposal doesn't check if the channel is open before closing it.
Also the acknowledgement should be fixed so it is only sent by the right subscriber.

API initialization problem

XComponentApi.CreateFromXCApi throws an exception when different components have the same state machine name

CreateSession issue with ConfigurationOverrides

On public IXCSession CreateSession(ConfigurationOverrides configurationOverrides = null) method the folllowing code should use string.IsNullOrEmpty instead of null:
if (configurationOverrides.Host != null)
{
busDetails.Host = configurationOverrides.Host;
}

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.