Changelog History
Page 2
-
v1.8.1 Changes
February 03, 2019Workflow Core 1.8.1
Thank you to @MarioAndron
๐ This release adds a feature where a DI scope is created around the construction of steps that are registered with your IoC container.
This enables steps to consume services registered as
scoped
. -
v1.8 Changes
January 19, 2019Workflow Core 1.8
๐ Elasticsearch plugin for Workflow Core
๐ A search index plugin for Workflow Core backed by Elasticsearch, enabling you to index your workflows and search against the data and state of them.
๐ง Configuration
๐ Use the
.UseElasticsearch
extension method onIServiceCollection
when building your service providerusing Nest; ...services.AddWorkflow(cfg =\>{ ... cfg.UseElasticsearch(new ConnectionSettings(new Uri("http://localhost:9200")), "index\_name"); });
Usage
Inject the
ISearchIndex
service into your code and use theSearch
method.Search(string terms, int skip, int take, params SearchFilter[] filters)
terms
A whitespace separated string of search terms, an empty string will match everything.
0๏ธโฃ This will do a full text search on the following default fields- Reference
- Description
- Status
- Workflow Definition
In addition you can search data within your own custom data object if it implements
ISearchable
using WorkflowCore.Interfaces; ...public class MyData : ISearchable{ public string StrValue1 { get; set; } public string StrValue2 { get; set; } public IEnumerable\<string\> GetSearchTokens() { return new List\<string\>() { StrValue1, StrValue2 }; } }
Examples
Search all fields for "puppies"
searchIndex.Search("puppies", 0, 10);
skip & take
๐ Use
skip
andtake
to page your search results. Whereskip
is the result number to start from andtake
is the page size.filters
You can also supply a list of filters to apply to the search, these can be applied to both the standard fields as well as any field within your custom data objects.
There is no need to implementISearchable
on your data object in order to use filters against it.The following filter types are available
- ScalarFilter
- DateRangeFilter
- NumericRangeFilter
- StatusFilter
These exist in the
WorkflowCore.Models.Search
namespace.Examples
Filtering by reference
using WorkflowCore.Models.Search; ...searchIndex.Search("", 0, 10, ScalarFilter.Equals(x =\> x.Reference, "My Reference"));
Filtering by workflows started after a date
searchIndex.Search("", 0, 10, DateRangeFilter.After(x =\> x.CreateTime, startDate));
Filtering by workflows completed within a period
searchIndex.Search("", 0, 10, DateRangeFilter.Between(x =\> x.CompleteTime, startDate, endDate));
Filtering by workflows in a state
searchIndex.Search("", 0, 10, StatusFilter.Equals(WorkflowStatus.Complete));
Filtering against your own custom data class
class MyData{ public string Value1 { get; set; } public int Value2 { get; set; } }searchIndex.Search("", 0, 10, ScalarFilter.Equals\<MyData\>(x =\> x.Value1, "blue moon"));searchIndex.Search("", 0, 10, NumericRangeFilter.LessThan\<MyData\>(x =\> x.Value2, 5))
Action Inputs / Outputs
โ Added the action Input & Output overloads on the fluent step builder.
Input(Action\<TStepBody, TData\> action);
This will allow one to manipulate properties on the step before it executes and properties on the data object after it executes, for example
Input((step, data) =\> step.Value1 = data.Value1) .Output((step, data) =\> data["Value3"] = step.Output) .Output((step, data) =\> data.MyCollection.Add(step.Output))
๐ฅ Breaking changes
The existing ability to assign values to entries in dictionaries or dynamic objects on
.Output
was problematic,
since it broke the ability to pass collections on the Output mappings..Output(data =\> data["Value3"], step =\> step.Output)
๐ This feature has been removed, and it is advised to use the action Output API instead, for example
.Output((step, data) =\> data["Value3"] = step.Output)
This functionality remains intact for JSON defined workflows.
-
v1.7 Changes
January 13, 2019Workflow Core 1.7.0
๐ Various performance optimizations, any users of the EntityFramework persistence providers will have to update their persistence libraries to the latest version as well.
โ Added
CancelCondition
to fluent builder API..CancelCondition(data => <<expression>>, <<Continue after cancellation>>)
This allows you to specify a condition under which any active step can be prematurely cancelled.
โฑ For example, suppose you create a future scheduled task, but you want to cancel the future execution of this task if some condition becomes true.builder .StartWith(context =\> Console.WriteLine("Hello")) .Schedule(data =\> TimeSpan.FromSeconds(5)).Do(schedule =\> schedule .StartWith\<DoSomething\>() .Then\<DoSomethingFurther\>() ) .CancelCondition(data =\> !data.SheduledTaskRequired) .Then(context =\> Console.WriteLine("Doing normal tasks"));
You could also use this implement a parallel flow where once a single path completes, all the other paths are cancelled.
.Parallel() .Do(then =\> then .StartWith\<DoSomething\>() .WaitFor("Approval", (data, context) =\> context.Workflow.IdNow) ) .Do(then =\> then .StartWith\<DoSomething\>() .Delay(data =\> TimeSpan.FromDays(3)) .Then\<EscalateIssue\>() ) .Join() .CancelCondition(data =\> data.IsApproved, true) .Then\<MoveAlong\>();
๐ Deprecated
WorkflowCore.LockProviders.RedLock
in favour ofWorkflowCore.Providers.Redis
Create a new
WorkflowCore.Providers.Redis
library that includes providers for distributed locking, queues and event hubs.- Provides Queueing support backed by Redis.
- Provides Distributed locking support backed by Redis.
- Provides event hub support backed by Redis.
This makes it possible to have a cluster of nodes processing your workflows.
Installing
๐ฆ Install the NuGet package "WorkflowCore.Providers.Redis"
๐ฆ Using Nuget package console
๐ฆPM> Install-Package WorkflowCore.Providers.Redis
Using .NET CLI
๐ฆdotnet add package WorkflowCore.Providers.Redis
Usage
๐ Use the
IServiceCollection
extension methods when building your service provider- .UseRedisQueues
- .UseRedisLocking
.UseRedisEventHub
services.AddWorkflow(cfg =>{ cfg.UseRedisLocking("localhost:6379"); cfg.UseRedisQueues("localhost:6379", "my-app"); cfg.UseRedisEventHub("localhost:6379", "my-channel") });
-
v1.6.9 Changes
December 30, 2018Workflow Core 1.6.9
๐ This release adds functionality to subscribe to workflow life cycle events (WorkflowStarted, WorkflowComplete, WorkflowError, WorkflowSuspended, WorkflowResumed, StepStarted, StepCompleted, etc...)
This can be achieved by either grabbing theILifeCycleEventHub
implementation from the IoC container and subscribing to events there, or attach an event on the workflow host classIWorkflowHost.OnLifeCycleEvent
.
This implementation only publishes events to the local node... we will still need to implement a distributed version of the EventHub to solve the problem for multi-node clusters.