Bot famework composer - Dependency injection in Custom Action - asp.net-core

I am referring to this article for running a long running task in background while returning 200 response immediately in bot framework composer.
https://github.com/EricDahlvang/ImmediateAcceptAdapter
Here, instead of Thread.Sleep in Custom Action, I have to make an http call which sometimes takes more than 15 secs.
I need some help in injecting a service with http call in the Sleep Custom Action.

Related

How to make Titanium.Network.createHTTPClient asynchronous

My application is getting slow when I try to make the Titanium.Network.createHTTPClient call though I'm making the call in the Alloy.js and the webservice is not depended on the screen as its a background call.
Alloy.Globals.xhr = Titanium.Network.createHTTPClient({
async: true,
onerror : function(e) {
},
timeout : 9000 // in milliseconds
});
My screen is getting halted until I get the response. How to call the service in background without effecting the screen/application performance
Ti SDK : 8.3.1.GA
Axway Appcelerator Studio,
build: 5.1.4.201909061933
Android Platform - Not working
iOS Platform - working
As pointed out in the documentation:
By default, the HTTPClient makes asynchronous requests. Asynchronous requests do not block the application and use callbacks to process responses when they are received.
Synchronous requests block the execution of the application until it receives a response. On the iOS platform, you can make synchronous requests by setting the optional async parameter to false when calling the open method.
The Android platform does not support synchronous requests.
There is no async parameter for the constructor, only inside the open() method for iOS: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Network.HTTPClient-method-open (optional 3rd parameter).
So the http request might not be the source for the slow down.
What you could try is to move the HTTPClient part out of the global space into a library or into the controller itself (for testing purposes). I use it in a Podcatcher app without blocking the UI and download multiple files without blocking the UI.

FLOWABLE: Authenticating flowable-task from another application via rest call

So, I am creating an application which will be using flowable.
We can say that once my application starts, it's gonna start a particular process deployed on flowable, proceed ahead accordingly.
So, in a way there will be lot of talking between flowable and other application, but for now suppose I just want to call flowable applications from POSTMAN (outside FLOWABLE).
I have used 3 modules: flowable-idm, flowable-modeler, flowable-task in my application.
Everything works fine when I am starting my deployed process from UI of flowable task, problems come when I want to start the processInstance using REST endpoint.
In flowable-task application, there is already a REST endpoint to start the process deployed: http://localhost:8080/flowable-task/app/rest/process-instances.
Now, if I call this from Swagger of flowable-task application, it works fine.
But it doesn't work when I try to call it from another application or POSTMAN for now (once POSTMAN call works, I can make the same arrangement in code), where I'm doing a basic auth and providing what's required in body.
Also, there is no error or exception displayed on console, I believe that is because of something catching that error or exception and not displaying anything.
However, to overcome the problem of starting process from POSTMAN, I can use REST endpoint http://localhost:9999/flowable-task/process-api/runtime/process-instances, but this is just a workaround, in future if I create new endpoints I would have to figure out a way to call those endpoints.
I saw this post and I guess this guy was also trying to achieve something similar but for flowable-modeler.
It's been suggested to make changes in SecurityConfiguration.java of flowable-task-conf module for my case, but I haven't done such changes before so not exactly sure where to start and how to proceed.
So, my question is how to talk to flowable-applications from outside flowable applications.
Edit:
Forum post about getting exception when imported flowable-rest module in workspace
The flowable-task UI Application is an example application that exposes non public REST API for the UI. However, the application also exposes the full REST API of Flowable.
There is also the flowable-rest application that has the Swagger doc and exposes the full REST API without a UI.
You would want to communicate with those REST endpoints.
The endpoints are under the following contexts:
process-api for the Process Engine
cmmn-api for the CMMN Engine
dmn-api for the DMN Engine
idm-api for the IDM Engine
form-api for the Form Engine
content-api for the Content Engine
For your example you would need to use POST to /process-api/runtime/process-instances for Starting a Process Instance

Call Hangfire Job (Recurring Job) from external API

I have been using Hang-fire in our project but had a question, Can i call a hangfire Recurring Job from an API?
For Example:
http://devmyproject.com/projectname/recurring is the url for Hangfire web application to get recurring job.
Now from my webApi project i want to call this Url and invoke a Job to run.
Is this Possible?
Thanks
In The HangFire Project i added an end points to make it an API to get the Requests and then run the Hangfire job. I added Fire and Forget Job to run the HangFire job.
Yes you can certainly perform hangfire functions by calling an API. Here is the function for creating a Hangfire job as listed on the front page of hangfire site.
RecurringJob.AddOrUpdate(
() => Console.WriteLine("Recurring!"),
Cron.Daily);
The URL you call should be an endpoint which you can pass parameters to. Then if hangfire is set up correctly it should be like any other application.

Detect Authorized response after AJAX call

I have an API which I consume from a VueJS app, backend is handled through Laravel 5.2.
I have setup automatic session timeout after 15min, but if happens you're in the site and try to do anything, I have a loading screen, and it freezes as you're unauthorized.
I wanted to know if there's any global method to read Unauthorized response when all requests are made.
I don't know what this is called, so I wouldn't know how to properly Google the feature.
I'm using VueJS Resource $http library to manage all requests.
Thanks!
I've finally made my way to the right documentation, it was under Vue-Resource, and these are called Interceptors.
https://github.com/vuejs/vue-resource/blob/master/docs/http.md

Retrieve response object after UI action?

so I've created several service tests where I validate the response object, normally using the requests library or http library to send a POST request for example.
This time however I'm doing an end-to-end test. Through the UI progressing through a workflow, one stage involves uploading a document, behind the scenes this will call a separate service, the response of which will contain some information that could be useful to me for further verification.
Is there a way to merge these? After the UI action can I 'listen' for the response object somehow?
I do NOT wish to call the endpoint directly as I want to prove the workflow is as intended, the endpoint is verified directly in service level tests already.
Integrate Selenium tests with BrowserMob Proxy and you will be able to 'listen' for the responses using HAR file:
https://bmp.lightbody.net/
Java repo where the feature is implemented: https://github.com/Wikia/selenium-tests