https://github.com/xcomponent/reactivexcomponent.net
C# API for XComponent
https://github.com/xcomponent/reactivexcomponent.net
dotnet-api nuget reactive reactive-programming xcomponent
Last synced: 8 months ago
JSON representation
C# API for XComponent
- Host: GitHub
- URL: https://github.com/xcomponent/reactivexcomponent.net
- Owner: xcomponent
- License: apache-2.0
- Created: 2016-05-24T08:26:06.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T04:23:07.000Z (over 3 years ago)
- Last Synced: 2025-08-30T06:36:07.990Z (8 months ago)
- Topics: dotnet-api, nuget, reactive, reactive-programming, xcomponent
- Language: C#
- Size: 3.49 MB
- Stars: 5
- Watchers: 9
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](http://slack.xcomponent.com/)
[](https://www.nuget.org/packages/ReactiveXComponent.Net)
[](https://www.nuget.org/packages/ReactiveXComponent.Net)

# .Net Reactive XComponent API

ReactiveXComponent.Net is a .Net client API that allows you to interact with microservices generated with XComponent software.
## Install
Use Nuget to install the latest version of the API:
``` nuget install ReactiveXComponent.Net -Pre```
## Usage
Usage example of ReactiveXComponent.Net API
```csharp
// All the info we need is in the xcApi file. Get a XComponentApi..
IXComponentApi xcApi = XComponentApi.CreateFromXCApi(@".\HelloWorld.xcApi");
// Create a session..
using (IXCSession xcSession = xcApi.CreateSession())
{
var componentName = "HelloWorld";
var helloWorldManagerStateMachineName = "HelloWorldManager";
var helloWorldResponseStateMachineCode = 1837059171;
// Create a subscriber..
var subscriber = xcSession.CreateSubscriber(componentName);
// Create a publisher..
var publisher = xcSession.CreatePublisher(componentName);
// Need to call subscribe for the state machine we are interested in..
subscriber.Subscribe(helloWorldManagerStateMachineName, arg => {});
// Subscribe to state machine updates via the IObservable collection..
var eventReceived = new ManualResetEvent(false);
var observer = Observer.Create(args =>
{
Console.WriteLine(args.MessageReceived);
eventReceived.Set();
});
var subscription = subscriber.StateMachineUpdatesStream
.Where(e => e.StateMachineRefHeader.StateMachineCode == helloWorldResponseStateMachineCode)
.Subscribe(observer);
// Send an event to a state machine..
var sayHiEvent = new SayHi() { To = "World" };
publisher.SendEvent(helloWorldManagerStateMachineName, sayHiEvent);
// Wait for state machine update and dispose subscription..
eventReceived.WaitOne(5000);
subscription.Dispose();
}
```
## Build from source
Download the source code and execute the following command in a PowerShell:
```
.\build.ps1 -Target All
```
That would build the source code run the tests and create a Nuget package under the *nuget* folder.
The complete command that contains all the possible parameters is as follows:
```
.\build.ps1 -Target --buildConfiguration= --buildVersion= --setAssemblyVersion=
```
**target** can be one of these values:
*Clean*
*RestoreNugetPackages*
*Build*
*Test*
*CreatePackage*
*All*
Default value: *Build*
**buildConfiguration** can be either *Debug* or *Release*.
Default value: *Release*
**buildVersion** is the build version to set for the assembly or Nuget package.
Default value: *1.0.0-build1*
**setAssemblyVersion** can be either *True* or *False*. When set to true the assembly version will be set to the value indicated by **buildVersion**.
Default value: *False*
## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push -u origin my-new-feature`
5. Submit a pull request
## License
Apache License V2