Coder Social home page Coder Social logo

zeebe-http-worker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

zeebe-http-worker's Issues

Running Docker image fails

Running the docker image using docker-compose file fails. docker run not reading the environment variables specified in the docker-compose file.
`version: "2"

services:
zeebe:
container_name: zeebe_worker_lock_order
image: camunda/zeebe-http-worker
environment:
- ZEEBE_CLIENT_WORKER_DEFAULTNAME='Lock Order'
- ZEEBE_CLIENT_WORKER_DEFAULTTYPE='LockOrder'
- ZEEBE_CLIENT_BROKER_CONTACTPOINT='127.0.0.1:26500'
Failing with below error
zeebe_worker_lock_order | 2020-01-23 15:17:24.031 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'zeebeClientLifecycle'; nested exception is java.lang.NullPointerException: target
zeebe_worker_lock_order | 2020-01-23 15:17:24.033 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
zeebe_worker_lock_order | 2020-01-23 15:17:24.049 WARN 1 --- [ main] o.s.b.f.support.DisposableBeanAdapter : Destroy method 'close' on bean with name 'zeebeClientLifecycle' threw an exception: java.lang.NullPointerException
zeebe_worker_lock_order | 2020-01-23 15:17:24.066 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
zeebe_worker_lock_order | 2020-01-23 15:17:24.138 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener :
zeebe_worker_lock_order |
zeebe_worker_lock_order | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
zeebe_worker_lock_order | 2020-01-23 15:17:24.153 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
zeebe_worker_lock_order |
zeebe_worker_lock_order | org.springframework.context.ApplicationContextException: Failed to start bean 'zeebeClientLifecycle'; nested exception is java.lang.NullPointerException: target
zeebe_worker_lock_order | at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) ~[spring-context-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:894) ~[spring-context-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) ~[spring-context-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE] zeebe_worker_lock_order | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE]
zeebe_worker_lock_order | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE]
zeebe_worker_lock_order | at io.zeebe.http.ZeebeHttpWorkerApplication.main(ZeebeHttpWorkerApplication.java:39) ~[classes!/:0.21.0-alpha4]
zeebe_worker_lock_order | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
zeebe_worker_lock_order | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
zeebe_worker_lock_order | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
zeebe_worker_lock_order | at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
zeebe_worker_lock_order | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[app.jar:0.21.0-alpha4]
zeebe_worker_lock_order | at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[app.jar:0.21.0-alpha4]
zeebe_worker_lock_order | at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) ~[app.jar:0.21.0-alpha4]
zeebe_worker_lock_order | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) ~[app.jar:0.21.0-alpha4]
zeebe_worker_lock_order | Caused by: java.lang.NullPointerException: target
zeebe_worker_lock_order | at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:787) ~[guava-20.0.jar!/:na]
zeebe_worker_lock_order | at io.grpc.internal.AbstractManagedChannelImplBuilder.(AbstractManagedChannelImplBuilder.java:180) ~[grpc-core-1.24.0.jar!/:1.24.0]
zeebe_worker_lock_order | at io.grpc.netty.NettyChannelBuilder.(NettyChannelBuilder.java:128) ~[grpc-netty-1.24.0.jar!/:1.24.0]
zeebe_worker_lock_order | at io.grpc.netty.NettyChannelBuilder.(NettyChannelBuilder.java:123) ~[grpc-netty-1.24.0.jar!/:1.24.0]
zeebe_worker_lock_order | at io.grpc.netty.NettyChannelBuilder.forAddress(NettyChannelBuilder.java:109) ~[grpc-netty-1.24.0.jar!/:1.24.0]
zeebe_worker_lock_order | at io.zeebe.client.impl.ZeebeClientImpl.buildChannel(ZeebeClientImpl.java:119) ~[zeebe-client-java-0.21.1.jar!/:0.21.1]
zeebe_worker_lock_order | at io.zeebe.client.impl.ZeebeClientImpl.(ZeebeClientImpl.java:76) ~[zeebe-client-java-0.21.1.jar!/:0.21.1]
zeebe_worker_lock_order | at io.zeebe.client.impl.ZeebeClientBuilderImpl.build(ZeebeClientBuilderImpl.java:221) ~[zeebe-client-java-0.21.1.jar!/:0.21.1]
zeebe_worker_lock_order | at io.zeebe.spring.client.config.ZeebeClientSpringConfiguration.lambda$zeebeClientObjectFactory$0(ZeebeClientSpringConfiguration.java:39) ~[spring-zeebe-0.7.1.jar!/:0.7.1]
zeebe_worker_lock_order | at io.zeebe.spring.util.ZeebeAutoStartUpLifecycle.start(ZeebeAutoStartUpLifecycle.java:52) ~[spring-zeebe-util-0.7.1.jar!/:0.7.1]
zeebe_worker_lock_order | at io.zeebe.spring.client.ZeebeClientLifecycle.start(ZeebeClientLifecycle.java:46) ~[spring-zeebe-0.7.1.jar!/:0.7.1]
zeebe_worker_lock_order | at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
zeebe_worker_lock_order | ... 22 common frames omitted
zeebe_worker_lock_order |
Gracefully stopping... (press Ctrl+C again to force)
Stopping zeebe_worker_lock_order ... done

`

Incorrect processing unicode symbols in responce body

Hello! We got a problem with russian characters in responce body.
We get:
{
"source": "StrawberryShake.Core",
"message": "продукт не найден: 5098c195-f96a-4a3d-b5d7-68d62e0a05a3"
}
But in zeebe operate (after zeebe-http-worker):
{
"source": "StrawberryShake.Core",
"message":"\u043F\u0440\u043E\u0434\u0443\u043A\u0442 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: 5098c195-f96a-4a3d-b5d7-68d62e0a05a3"
}
In elastic (kibana):
\"message\":\"\\u043F\\u0440\\u043E\\u0434\\u0443\\u043A\\u0442 \\u043D\\u0435 \\u043D\\u0430\\u0439\\u0434\\u0435\\u043D: 5098c195-f96a-4a3d-b5d7-68d62e0a05a3\"

We use zeebe-http-worker in k8s, i try to set LC_ALL: en_US.UTF-8 / c.UTF-8 / ru_RU.UTF-8, but it doesn't works.

Can we try something else?

Add feature to blacklist IPs/domains

In order to run http worker in Camunda Cloud SaaS we need a feature to blacklist certain IPs / domains from being accessed.

Otherwise an attacker could use the running http worker to access/modify information within our cluster. Same will hold true for self-managed deployments.

This may become obsolete for Camunda Cloud SaaS if the network topology changes and each resource only sees the other resources it is supposed to see.

Body of Http Post

Hello,
I am using the http worker to communicate with my Rest Microservices. One of my services accepts a POST request with a JSON body. I tried to set the body cariables in the headers using the zeebe modeler but it does not work. In the modeler there is no option to set Variables, the only options are Variable Mappings and Headers. How can I set the body of my request using the modeler ?
Thank you

Worker fails with exception if none of the new exposed environment variables are set

Checked out the most recent changes and attempted to run the worker without setting any of the new environmental variables such as ENV_VARS_URL (e.g. http://someUrl/config, default: null)
ENV_VARS_RELOAD_RATE (defaullt 15000), etc.

When worker is invoked, the following exception is raised:

java.lang.RuntimeException: Could not load variables from 'null': URI with undefined scheme
	at io.zeebe.http.EnvironmentVariableProvider.getVariables(EnvironmentVariableProvider.java:91) ~[classes/:na]
	at io.zeebe.http.HttpJobHandler.handle(HttpJobHandler.java:57) ~[classes/:na]
	at io.zeebe.http.ZeebeHttpWorkerApplication.handleFooJob(ZeebeHttpWorkerApplication.java:62) ~[classes/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
	at io.zeebe.spring.client.bean.MethodInfo.invoke(MethodInfo.java:31) ~[spring-zeebe-0.7.1.jar:0.7.1]
	at io.zeebe.spring.client.config.processor.ZeebeWorkerPostProcessor.lambda$null$1(ZeebeWorkerPostProcessor.java:49) ~[spring-zeebe-0.7.1.jar:0.7.1]
	at io.zeebe.client.impl.worker.JobRunnableFactory.executeJob(JobRunnableFactory.java:44) ~[zeebe-client-java-0.21.1.jar:0.21.1]
	at io.zeebe.client.impl.worker.JobRunnableFactory.lambda$create$0(JobRunnableFactory.java:39) ~[zeebe-client-java-0.21.1.jar:0.21.1]
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:na]
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: java.lang.IllegalArgumentException: URI with undefined scheme
	at java.net.http/jdk.internal.net.http.common.Utils.newIAE(Utils.java:244) ~[java.net.http:na]
	at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.checkURI(HttpRequestBuilderImpl.java:79) ~[java.net.http:na]
	at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.uri(HttpRequestBuilderImpl.java:71) ~[java.net.http:na]
	at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.uri(HttpRequestBuilderImpl.java:43) ~[java.net.http:na]
	at io.zeebe.http.EnvironmentVariableProvider.refreshM2mToken(EnvironmentVariableProvider.java:132) ~[classes/:na]
	at io.zeebe.http.EnvironmentVariableProvider.createHttpRequest(EnvironmentVariableProvider.java:102) ~[classes/:na]
	at io.zeebe.http.EnvironmentVariableProvider.getVariables(EnvironmentVariableProvider.java:65) ~[classes/:na]

I am also able to duplicate the problem by commenting out these lines in the unit test:

@SpringBootTest(properties = {
    "ENV_VARS_URL=http://localhost:8089/config", "ENV_VARS_RELOAD_RATE=0",    
    "ENV_VARS_M2M_BASE_URL:http://localhost:8089/token", "ENV_VARS_M2M_CLIENT_ID:someClientId", "ENV_VARS_M2M_CLIENT_SECRET:someSecret", "ENV_VARS_M2M_AUDIENCE:someAudience"})

If these are optional configuration parameters, the worker should not fail.

The purpose of these new environment variables is also not quite clear.

Jobs are not executed after a while

Issue: Jobs are executed if worker boots up and jobs are already waiting. As soon as the worker is started and new instances have been started some jobs are executed but at some point further jobs are not activated and instances are pending.
Environment: Cloud and locally
Steps to reproduce locally:

cd operate
docker-compose up
java -jar zeebe-http-worker.jar
  • Deploy a workflow including a service task with type http and start some instances until jobs are not executed anymore. I used https://github.com/camunda-cloud/camunda-cloud-examples for this - in the example the service task calls the github api and updates the labels

    • For the first time this works like a charme
  • Wait two minutes

  • Start a new instance again: job is not executed

Configuration keys overwrite each other

Configuration keys from variable mappings clobber those from custom headers when merged to form the body of a POST request. For example:

Custom Header:
body: {event_type: "message", client_payload: {message_name: "THROW_YO"}}

Input Variable mapping:
test: body.client_payload.test

Expected Output:

{
    body: {
		event_type: "message", 
		client_payload: {
			message_name: "THROW_YO",
			test: ${value of variables.test}
		}
	}
}

Actual output:

{
	body: {
		client_payload: {
			test:"value"
	}
}

I expect a JSON merge. It's probably non-trivial to write in Java, but if you create a ScriptEngine you can have it convert the Maps to JSON and do an Object.assign.

"JavaScript: JSON done right"

503 response causes halt

If the HTTP Worker gets a 503, it doesn't raise an incident or return an error. The process just halts.

Screen Shot 2020-02-13 at 5 01 51 pm

Screen Shot 2020-02-13 at 5 05 28 pm

Screen Shot 2020-02-13 at 5 06 14 pm

Screen Shot 2020-02-13 at 5 06 37 pm

Inconsistent order of variable preference in ConfigurationMaps.java

It looks like there are effectively two ways to retrieve the configuration for a job via the ConfigurationMaps class: the get (or getString) or getConfig methods.

However, the custom headers, job variables, and environment variables are added to the config map in a different order than they are referenced by the get method.

For example, if a job has a custom header "foo" with value "foo" and also a variable "foo" with value "bar", a call to get or getString will return "foo" while using getConfig and then retrieving "foo" from the config will result in a value of "bar".

Here is the code in question.

What is the intended order of preference for these variables?

Add JWT authorization to EnvironmentVariableProvider

Example from legacy code: https://github.com/camunda-cloud/zeebe-http-worker/compare/cep004_auth_for_http-worker

Three environment variables that will be set:

  • AUTH0_BASE_URL <- der endpunkt von dem man die jwt tokens beziehen kann
  • AUTH0_CLIENT_ID <- die client Id fuer den spezifischen worker
  • AUTH0_CLIENT_SECRET <- das dazugehoerige secret
  • AUTH0_AUDIENCE < (e.g. variableEndpointAudience = process.env.ENV_VARS_URL.replace('https://', '').split(':')[0]; //variables.cloud.dev.ultrawombat.com )

Needs to go into https://github.com/zeebe-io/zeebe-http-worker/blob/master/src/main/java/io/zeebe/http/EnvironmentVariableProvider.java

Accept SOAP request in Worker

The worker currently doesn't accept receiving xml, it fails to convert it to Json, to solve this issue, I develop a code which makes SOAP request available, transforming it into Json in the worker and returning it to Zeebe. I will put it as a pull request.

Configure custom type for worker

Currently the type for which the worker is registered is not configurable and set to http. In some use cases it would be useful to set a custom type.

The worker name is already configurable via the environment variable ZEEBE_WORKER_NAME. The same approach would fit to set the worker type with a new env var ZEEBE_WORKER_TYPE.

worker throws an error when API point returns the empty body

Hi everyone!

Zeebe and zeebe-http-worker both are very interesting ambitious solutions 👍

I took one of our services which has a healthcheck API point /api/healthcheck which returns the empty body to test zeebe-http-worker. And I had next error

java.lang.RuntimeException: Failed to deserialize response body from JSON: OK
    at io.zeebe.http.HttpJobHandler.bodyToObject(HttpJobHandler.java:189) ~[classes!/:0.22.0]
    at java.base/java.util.Optional.map(Optional.java:258) ~[na:na]
    at io.zeebe.http.HttpJobHandler.processResponse(HttpJobHandler.java:179) ~[classes!/:0.22.0]
    at io.zeebe.http.HttpJobHandler.handle(HttpJobHandler.java:77) ~[classes!/:0.22.0]
    at io.zeebe.http.ZeebeHttpWorkerApplication.handleFooJob(ZeebeHttpWorkerApplication.java:53) ~[classes!/:0.22.0]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
    at io.zeebe.spring.client.bean.MethodInfo.invoke(MethodInfo.java:31) ~[spring-zeebe-0.22.0.jar!/:0.22.0]
    at io.zeebe.spring.client.config.processor.ZeebeWorkerPostProcessor.lambda$null$1(ZeebeWorkerPostProcessor.java:49) ~[spring-zeebe-0.22.0.jar!/:0.22.0]
    at io.zeebe.client.impl.worker.JobRunnableFactory.executeJob(JobRunnableFactory.java:44) ~[zeebe-client-java-0.22.0.jar!/:0.22.0]
    at io.zeebe.client.impl.worker.JobRunnableFactory.lambda$create$0(JobRunnableFactory.java:39) ~[zeebe-client-java-0.22.0.jar!/:0.22.0]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:832) ~[na:na]

Is it a bug or by design?

Thank you.

Running Docker image fails

Running the java application locally works But running the docker image fails with:
08:17:25.624 [main] WARN org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. 08:17:25.627 [main] WARN org.springframework.beans.factory.support.DisposableBeanAdapter - Destroy method 'close' on bean with name 'zeebeClientLifecycle' threw an exception java.lang.NullPointerException: null at io.zeebe.spring.util.ZeebeAutoStartUpLifecycle.stop(ZeebeAutoStartUpLifecycle.java:62) at io.zeebe.spring.util.ZeebeAutoStartUpLifecycle.stop(ZeebeAutoStartUpLifecycle.java:71) at io.zeebe.spring.client.ZeebeClientLifecycle.close(ZeebeClientLifecycle.java:61) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:339) at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:273) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:571) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:543) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1072) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:504) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1065) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1060) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:563) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) at io.zeebe.http.ZeebeHttpWorkerApplication.main(ZeebeHttpWorkerApplication.java:35) 08:17:25.632 [main] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) at io.zeebe.http.ZeebeHttpWorkerApplication.main(ZeebeHttpWorkerApplication.java:35) Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:203) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) ... 8 common frames omitted

The HTTP Worker needs to access Zeebe Job data

In some cases the HTTP Worker needs to able to pass on information about the current job, at least the job id (which is required to correlate later on).
This should be supported via expression language.

Maybe it is already possible, then just double check and document it :-)

Headers should be case-insensitive

At the moment a header of URL doesn’t work on a task, and a header of url does.

Is there any good reason to make them case-sensitive?

It’s just friction from a useability perspective. The user’s intent is unambiguous, regardless of the casing of the header, so the worker should ignore case by calling toLowerCase() on header keys before parsing them.

Grpc metadata

Hi! When calling the grpc-method "/gateway_protocol.Gateway/ActivateJobs" to the zeebe gateway, we need to add the type of task in the headers, for example: "job-type: http".
Does the current implementation allow this without fixing the java code and compiling?

default for ENV_VARS_RELOAD_RATE not working

we are trying to get the zeebe-http-worker into camunda-cloud, these are the env-vars we are setting for the container:

**    Environment:
      DEBUG:                             express:*
      ZEEBE_CLIENT_BROKER_CONTACTPOINT:  zeebe-service
      CLUSTER_NAME:                      XXX
      ENV_VARS_URL:                      https://variables.XXX/private/variables/XXX
      ENV_VARS_M2M_BASE_URL:             https://login.cloud.XXX/oauth/token
      ENV_VARS_M2M_CLIENT_ID:            XXX
      ENV_VARS_M2M_CLIENT_SECRET:        XXX
      ENV_VARS_M2M_AUDIENCE:             variables.XXX
**
10:57:25.975 [main] WARN org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zeebeHttpWorkerApplication': Unsatisfied dependency expressed through field 'jobHandler'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'httpJobHandler': Unsatisfied dependency expressed through field 'environmentVariableProvider'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'environmentVariableProvider': Unsatisfied dependency expressed through field 'config'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zeebeHttpWorkerConfig': Unsatisfied dependency expressed through field 'environmentVariablesReloadIntervalMs'; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'long'; nested exception is java.lang.NumberFormatException: For input string: "${ENV_VARS_RELOAD_RATE:15000}"
10:57:26.074 [main] WARN org.springframework.beans.factory.support.DisposableBeanAdapter - Destroy method 'close' on bean with name 'zeebeClientLifecycle' threw an exception
java.lang.NullPointerException: null
	at io.zeebe.spring.util.ZeebeAutoStartUpLifecycle.stop(ZeebeAutoStartUpLifecycle.java:62)
	at io.zeebe.spring.util.ZeebeAutoStartUpLifecycle.stop(ZeebeAutoStartUpLifecycle.java:71)
	at io.zeebe.spring.client.ZeebeClientLifecycle.close(ZeebeClientLifecycle.java:61)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:339)
	at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:273)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:571)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:543)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1072)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:504)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1065)
	at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1060)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:563)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
	at io.zeebe.http.ZeebeHttpWorkerApplication.main(ZeebeHttpWorkerApplication.java:39)
10:57:26.371 [main] ERROR org.springframework.boot.SpringApplication - Application run failed

we aren't setting ENV_VARS_RELOAD_RATE intentionally and were expecting the default would kick in ;-)

Configurable behavior on HTTP status codes

Originally came up to Allow HTTP 202 for HTTP as a service task could be to invoke an HTTP endpoint:

68870485-3f7dfa00-06fb-11ea-9cff-a46e7e9c6a66

If that HTTP endpoint returns a 202 it means, that it will do the processing asynchronously. In this case the following behavior of the HTTP Worker would be beneficial:

  • Lock the task for a configured timeout (e.g. 10 minutes), so that the HTTP request is not done again
  • Do NOT complete the current job, so that the workflow keeps waiting in the service task
  • Some external component needs to call back Zeebe with the job id in order to complete it, so that the workflow moves on
  • If this does not happen within the timeout, the HTTP request is retried

This might happen around https://github.com/camunda-cloud/zeebe-http-worker/blob/master/src/worker/worker.ts#L136

A discussion is if we need to have this behavior configurable. Or in other words: Do people want the workflow to continue in case of HTTP 202 (I could imagine that this is the expectation for most people).

Together with #3 this improves the support for orchestration of functions. So for example in AWS it could work like this:

68871059-26c21400-06fc-11ea-9515-79107439b966

As an alternative you could go for an explicit modeling of the asynchronous indirection:

68927888-173cdc80-0789-11ea-92b7-7aca265afe01

The downside is that the workflow model gets pretty bloated. While it is technically correct and you could argue that it is good that you can see it is asynchronous under the hood, I am pretty sure a lot of people will freak out about it, especially compared to AWS Step Functions where it is always one box.

Also another challenge with that alternative is the correlation (how to route the message to the right waiting workflow instance). In the 202 scenario described above this is solved by the "jobId" from Zeebe. In the async modeling scenario somebody has to create a unique UUID to be used for correlation. This is currently not out-of-the-box with the HTTP cloud worker.

Allow setting additional HTTP headers (e.g. api-key)

In the earlier version of the cloud worker it was possible to set additonal http headers via the Zeebe Task Headers, e.g.

<bpmn:serviceTask id="ServiceTask_BookHotel" name="Book hotel">
      <bpmn:extensionElements>
        <zeebe:taskDefinition type="CAMUNDA-HTTP" retries="" />
        <zeebe:taskHeaders>
          <zeebe:header key="x-api-key" value="${aws-api-key}" />
          <zeebe:header key="url" value="${aws-lambda-base-url}/hotel/book" />
          <zeebe:header key="method" value="put" />
        </zeebe:taskHeaders>
      </bpmn:extensionElements>
 </bpmn:serviceTask>

This is not possible anymore with the current worker, but it makes a ton of sense to have it. It still need to be decided how exactly this is configured. I would probably simply propose a simple naming convention of the key, e.g. 'header-x-api-key', but haven't gave it another thought.

<bpmn:serviceTask id="ServiceTask_BookHotel" name="Book hotel">
      <bpmn:extensionElements>
        <zeebe:taskDefinition type="CAMUNDA-HTTP" retries="" />
        <zeebe:taskHeaders>
          <zeebe:header key="header-x-api-key" value="${aws-api-key}" />
          <zeebe:header key="url" value="${aws-lambda-base-url}/hotel/book" />
          <zeebe:header key="method" value="put" />
        </zeebe:taskHeaders>
      </bpmn:extensionElements>
 </bpmn:serviceTask>

Jobs fail if there are no cloud variables set at all

Should work with an empty map instead.

java.lang.RuntimeException: Could not load variables from 'https://variables.cloud.dev.ultrawombat.com/private/variables/0a34365c-73a5-45cc-9063-a16b192c5fd4': No content to map due to end-of-input at [Source: (String)""; line: 1, column: 0] at io.zeebe.http.EnvironmentVariableProvider.getVariables(EnvironmentVariableProvider.java:91) at io.zeebe.http.HttpJobHandler.handle(HttpJobHandler.java:65) at io.zeebe.http.ZeebeHttpWorkerApplication.handleFooJob(ZeebeHttpWorkerApplication.java:53) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at io.zeebe.spring.client.bean.MethodInfo.invoke(MethodInfo.java:31) at io.zeebe.spring.client.config.processor.ZeebeWorkerPostProcessor.lambda$null$1(ZeebeWorkerPostProcessor.java:49) at io.zeebe.client.impl.worker.JobRunnableFactory.executeJob(JobRunnableFactory.java:44) at io.zeebe.client.impl.worker.JobRunnableFactory.lambda$create$0(JobRunnableFactory.java:39) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input at [Source: (String)""; line: 1, column: 0] at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4344) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4189) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3205) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3188) at io.zeebe.http.EnvironmentVariableProvider.getVariables(EnvironmentVariableProvider.java:83) ... 16 more

How to add as POM dependency and register as Zeebe Worker ?

Help me with integrating this as repo as dependency and get http zeebe worker registered...

I am able to include as dependency with below..

io.zeebe
zeebe-http-worker
1.2.0

But its not registering as Zeebe worker and still unable to invoke worker... adding worker properties in application.yaml does not help either.. Kindly provide info on this ..

Thanks in advance..

Variables returned from HTTP task are no longer available in parent scope

In the previous release of this task, the following variables were returned:

  • statusCode
  • body

Without defining any output mapping, it was possible to reference these variables in downstream paths of a workflow. For example, I used the statusCode in one branch of the exclusive gateway as follows:

statusCode == 200 && someOtherProperty != null

This worked.

With the current release, statusCode is no longer available in scope of the parent process. Meaning this variable can no longer be used in downstream steps or conditions unless you define an output mapping on the http task as follows:

Output Mapping:
source: statusCode
target: statusCode

According to the literature, if output mappings are not defined, variables returned from a task or process will be merged into the parent variable scope.

Please refer to the BPMN model and rename from .txt to .bpmn.

Associated code to run the workflow is as follows:

DeploymentEvent deployment =
				client.newDeployCommand().addResourceFromClasspath("simple-http-process.txt").send().join()

        	OffsetDateTime now = OffsetDateTime.now();

		final Map<String, Object> post = new HashMap<>();
		post.put("userid", "1");
		post.put("title", now.toString() +  ": it's all about clean code");
		post.put("body",  now.toString() + " : read some good books on clean code");

		// FOR REST, you specify payload as parameter like this.  In other words there must be context variable called "body"
		final Map<String, Object> payload = new HashMap<>();
		payload.put("postToCreate", post);

		WorkflowInstanceEvent wfInstance =	client
						.newCreateInstanceCommand()
						.bpmnProcessId("simple-http-process")
						.latestVersion()
						.variables(payload)
						.send()
						.join();

simple-http-process.txt

Decide whether we want to keep or remove Moustache support

Currently this worker uses Moustache for templating. As part of the Connectors topic this approach was questioned. Overall sentiment seemed to be in favor of having templating done with FEEL expressions and using the engine to do it.

At the same time, if the worker is used in a connector and corresponding element template, then this setup allows less flexibility to define in and output mappings. As far as I understand, the element template will add explicit input mappings for URL, method, etc. And because there is an explicit mapping, it doesn't simply copy all variables. So in essence the worker is called with only URL, method, etc. So there is nothing to run the template engine against

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.