Does Kogito support asynchronous business rule/service task execution? - kogito

Does Kogito support asynchronous execution of business rule/service task if marked as async = true in BPMN ?

Currently async is not supported in kogito processes runtime, so basically if you set the async property in the editor is not considered by the runtime.
We have it tracked and still investigating to incorporate the feature in the next releases, once it is done it will be announced in the release notes as usual.

Great news ... kogito version 1.15.0 comes with asyncronous functionality implementation. (https://docs.kogito.kie.org/latest/html_single/#_kogito_async_execution_support_for_process_nodes)

Related

Node js vs Kotlin for REST APIs

Kotlin vs Node JS for REST Api's
I couldn't find any proper explanation regarding the differences b/w Kotlin and Node JS for REST APIs
Which is better in performance wise?
Let me set the context. Its Kotlin/JVM vs JS/Node.js. We cannot blindly say that this language is better. In general Kotlin is supposed to be faster since it compiled language compared to JS which is interpreted language.
Irrespective of the language used, we will discuss on the API architecture. Serving the APIs can be implemented in either blocking or non-blocking way (I am not going to explain about what it is). Traditionally before a few of years Java/Kotlin with Spring have been using the blocking architecture which delivered performance X. On a contrary, Node.js is based on non-blocking architecture which gave us better performance than the blocking architecture and architecture style is the only reason why Node.js performed better. Later Spring released a newer version of the framework to support non-blocking architecture. The non-blocking style is called as Reactive programming/Spring Webflux.
So now both of the languages support non-blocking architecture. In terms of raw language performance, Kotlin will be better since its compiled language. Also in theory interpreted languages are supposed to be slower. But we cannot say which is better without any testing.
Personally I am fan of Java/Spring because of OOPS and later at one point I started using TS/Node.js. TS eliminates most of the runtime issues with its type checking. But still we cannot compare it with the type system available in Java/Kotlin. As a language I feel Java/Kotlin is superior and one thing I like most in JavaScript is handling objects/JSON. Checkout "Kotlin for JavaScript" as well which lets you write in Kotlin and transpile to JS. Ignore this "Kotlin for JavaScript" feature, I am planning to try Kotlin/Spring in non-blocking architecture for my future projects. If you have usecases with WebSockets, I think Node.js will perform better and I am not sure If there are any libraries in Java/Kotlin since I havn't explored it.
One disadvantage in non-blocking style is that I need to pass the login context object to almost all the methods in the project. In blocking architecture we will add the login context information in thread local so that we can access it anywhere until the request is completed.
I am sure that I did not answer your question completely. But I hope that the information what I have give is useful.
Correct me If I am wrong in any of the aspects.

Does Swift have any native concurrency and multi-threading support?

I'm writing a Swift client to communicate with a server (written in C) on an embedded system. Its not iOS/OSX related as I'm using the recently released Ubuntu version.
Does Swift have any native support for concurrency? I'm aware that Apple discourages developers from using threads and encourages handing tasks over to dispatch queues via GCD. The issue is that GCD seems to be only on Darwin (and NSThread is a part of Cocoa).
For example, C++11 and Java have threads and concurrency as a part of their standard libraries. I understand that platform specific stuff like posix on unix could be used under some sort of C wrapper, but for me that really ruins the point of using Swift in the first place (clean, easy to understand code etc.).
2021 came and...
Starting with Swift 5.5, more options are available like async/await programming models and actors.
There is still no direct manipulation of threads, and this is (as of today) a design choice.
If you’ve written concurrent code before, you might be used to working with threads. The concurrency model in Swift is built on top of threads, but you don’t interact with them directly. An asynchronous function in Swift can give up the thread that it’s running on, which lets another asynchronous function run on that thread while the first function is blocked.
Original 2015 answer
Quoting from Swift's GitHub, there's a readme for "evolutions" :
Concurrency: Swift 3.0 relies entirely on platform concurrency primitives (libdispatch, Foundation, pthreads, etc.) for concurrency. Language support for concurrency is an often-requested and potentially high-value feature, but is too large to be in scope for Swift 3.0.
I guess this means no language-level "primitives" for threading are in the pipeline for the foreseeable future.

scalability in client object model vs web services

I have a app in which I need to query a sharepoint site via services. The app will be under heavy usage so performance and scalability will be two of my priorities.
I started to investigate which service approach is better and from a perf point of view it seems that client object model is the one officially suggested, but when I came to scalability I personally found that actually web services seem more potent than client object model. This is because it seems that web services have async support for IO bound operations rather than client object model that doesn't. I say doesn't because as Stephen Toub said the ability to invoke a synchronous method asynchronously does nothing for scalability and I think BeginInvoke does just that.
I have to mention that I am using in my app C# 5 async/await feature in order to return the thread to the thread pool when queries are executed on the server.
My question is, what should weight more in order to take a decision?
Edit: It is worth to mention that I am not using the Silverlight CSOM, I am using the more generic .NET one.
This is an answer with no answer. :)
You are correct in that BeginInvoke is fake-asynchronous (i.e., it just issues the blocking call on a thread pool thread). So it would actually be worse, scalability-wise, than just invoking the blocking methods.
First, consider your scalability as compared to your Sharepoint server. If you're running on roughly equivalent hardware, then you probably don't need to scale any more than the Sharepoint server will. You would probably be fine with either solution.
If you do need to scale better (e.g., the Sharepoint server is a cluster or cloud, or if your machine is much lesser than the Sharepoint machine), then it requires more thought and likely testing.
The better performance in the client model is purely from its batching capabilities. So if your application won't use batching, then the (asynchronous) web services model would be better.
However, if your application uses batching and needs to scale better, then there isn't an answer. In this case, the only way to know is to build a test case both ways and measure it.
Actually, the client object model not only provides, but sometimes requires asynchronous access. You can find more info in the Data Retrieval Overview but the short version is that:
You create and load one or more queries in a ClientRuntimeContext then
Execute all loaded queries either synchronously with ClientRuntimeContext.ExecuteQuery or asynchronously with ClientRuntimeContext.ExecuteQueryAsync with two callbacks for success or failure
You don't have to use BeginInvoke anywhere.
In fact, the Client object model in Silverlight provides only the Async method in which case you are forced to execute the call asynchronously.
The syntax is quirky, but the client object model targets .NET 3.5 and Silverlight, so it wasn't possible to provide a Task based interface. You can even argue that callbacks are somewhat simpler than the Begin/End pattern and definitelly better that raising completion events.
EDIT
As #alexb noticed, ExecuteQueryAsync is available only in Silverlight. There are other ways to work asynchronously though.
You can take advantage of Sharepoint's OData support to query lists using WCF Data Services. The query scenario is a bit similar, as you submit your query and wait for a callback when the results come in. In the meantime, you get access to a DataServiceQuery object that represents the asynchronous query.
This method uses REST/Json and therefore lighter on the wire than the web services. The LINQ and ORM-like API are also easier to work with compared to the web services.
Sharepoint's support is described in Query SharePoint Foundation with ADO.NET Data Services and asynchronous querying is described in How to: Execute Asynchronous Data Service Queries (WCF Data Services)

Does service bus have Task bases API

I just want to know, does service bus support async programming.
Can I use Async/Await in service bus?
How should I do that?
Does there any samples for that?
Thanks.
The beta of sdk 2.0 has this, see http://nuget.org/packages/WindowsAzure.ServiceBus/2.0.0-beta for the bits, and check http://blogs.msdn.com/b/windowsazure/archive/2013/04/11/task-based-apis-for-service-bus.aspx for example of api usage
I think most of the Azure client libraries (SDK) do have support for asyncronous calls. In fact, this is the suggested way of using them. For example, the QueueClient type (part of ServiceBus cliend SDK) has a bunch of Begin*, End* methods. You may find the list of all methods here.
However these signatures are using the pattern with IAsyncResult, which is different from the Async/Await pattern.
So to answer your question more correctly: No, the current version of ServiceBus does not support task based async processing. It does however support IAsyncResult based asynchronous processing.

Intercepting events and controlling behaviour via events for BPEL runtime engine

I would like to
1. intercepting events and
2. controlling behaviour via events for BPEL runtime engine. May I know which BPEL runtime engine support this?
For 1. for example when an invocation to a service name "hello", I would like to receive the event "invoke_hello" from the server.
For 2. for example, when the server has parallel invocation of 3 services, "invoke_hello1", "invoke_hello2" and "invoke_hello3", I could control the behaviour by saying I would only allowed "invoke_hello1" to be run.
I am interested if there is any BPEL engines that supports 1, or 2, or both, with its documentation page that roughly talked about this (so I could make use of this feature).
Disclaimer: I haven't personally used the eventing modules of these engines, so I cannot guarantee that they work as they promise.
Concerning question 1 (event notification):
Apache ODE has support for Execution Events. These events go into its database, and you have several ways of retrieving events. You can:
query the database to read them.
use the engines Management API to do this via Web Services
add your own event listener implementation to the engine's classpath.
ODE's events concern the lifecycle of activities in BPEL. So your "invoke_hello" should map to one of the ActivityXXX events in ODE.
The Sun BPEL Service Engine included in OpenESB has some support for alerting, but the documentation is not that verbose concerning how to use it. Apparently, you can annotate activities with an alert level and events are generated when an activity is executed.
Concerning question 2 (controlling behaviour):
This is hard and I am not sure if any engine really supports this in normal execution mode. One straight-forward way of achieving this would be to execute the engine in debug mode and to manually control each step. So you could skip the continuation of "invoke_hello2" and "invoke_hello3" and just continue with "invoke_hello1".
As far as I know, ODE does not have a debugger. The Sun BPEL Service Engine on the other hand, has quite a nice one. It is integrated in the BPEL editor in Netbeans which is a visual editor (that uses BPMN constructs to visualize BPEL activities) and lets you jump from and to every activity.
Another option would be to manually code your own web service that intercepts messages and forwards these to the engine depending on your choice. However, as I understand your question, you would rather like an engine that provides this out of the box.
Apparently Oracle BPEL also has support for eventing and according to this tutorial also comes with a debugger, but I haven't used this engine personally so far, so I won't include it in this answer.

Resources