Spring cloud task on data flow server vs #EnableTask - spring

I am new to Spring cloud data flow. Trying to figure out what it mean by registering, creating a task on spring cloud data flow server vs running a spring class with annotation #EnableTask
Any clarification to understand what these two are, will be helpful!

With Spring Cloud Task, you'd build and test standalone Task microservices in isolation. With the programming model, you can address use-cases ranging from ETL/ELT, data migration, or predictive-model-training etc.
Once you have an "n" no. of such applications, you could use Spring Cloud Data Flow's DSL to compose them into coherent Task/Batch pipelines. To use them in the DSL, you'd have to first register the coordinates of the standalone Task Apps.
Refer to the SCDF's Task overview and as well as the Task Developer Guide for more details - you could repeat it locally to follow along and learn the mechanics.

Related

Access remote Camunda service programmatically

I have a remote server installation of the Camunda BPM Platform (installed using the Camunda BPM Platform Helm Chart - https://github.com/camunda-community-hub/camunda-helm/tree/main/charts/camunda-bpm-platform). It is working as expected and, while new to BPM, I have been able to try out some workflows and examples successfully.
I am now trying to connect to it remotely and register for thrown events. I've been following https://docs.camunda.org/manual/7.15/reference/bpmn20/events/signal-events/ however I am stumped as to how I can get a handle to runtimeService. Other than using the REST API is there another way to connect to a remote Camunda service? I've tried using the camunda-bpm-spring-boot-starter-external-task-client but no RuntimeService gets initialized. Perhaps I'm missing some remote-specific configuration but I have not found anything in the documentation so far. Based on https://camunda.com/best-practices/deciding-about-your-stack/ I understand that this should be possible - however, all examples I've found deal with an embedded service. Any help is appreciated!
CAMUNDA offers a Java API and a REST API. In addition there are official or community client libraries, which all rely on the REST API. The Java API is only available to code which gets deployed inside the CAMUNDA JVM.
To interact with the engine from outside the JVM you have to use the REST API. The endpoints are named after the resources, not after the Java API services. Hence you You will not find a RuntimeService endpoint on the REST API, but you will find all the functionality the RuntimeService offers, e.g. start via process-definition.
If you do not want to deploy code in the CAMUNDA JVM, then service integration is done preferably using the external task pattern. If you want to use Java, especially the new Spring Boot Starter for external task clients is fun to work with. If you prefer other languages, check out https://github.com/camunda/awesome-camunda-external-clients.
Unfortunately there currently is no implementation type external for signal events so far. Ootb you can work with signal events for 1:n communication between different BPMN processes on the same environment. If you want to send the signal to an external event bus, then you need to add this functionality to the same JVM as a one-time effort. Here is an example for Azure event bus: https://github.com/camunda-consulting/code/tree/master/snippets/engine-plugin-signal-to-azure-eventhub. The implementation would look very similar for SQS or other alternatives.
If you need to modify the container image to include custom code then you can either just add own jars to e.g. the CAMUNDA RUN Docker image as shown here: https://github.com/rob2universe/bpmrun-add-to-dockerimg
or you could build your own image based on the Spring Boot Starter as shown here: https://github.com/rob2universe/camunda-aks

Does Spring Data Flow and Spring Cloud Stream is what I need to build a data processing pipeline with Choreography approach?

I am planning to implement a data processing pipeline using the Microservice Architecture in Java. Since I have been using Spring boot to implement some of the Microservice already, I am investigating the rest of Spring components to see which one can help me to address my requirements. I have found out Spring Cloud Stream helps me to implement my solution using the event-driven approach, but I am not quite sure whether Spring Data Flow acts as a Single Point of Failure and does the orchestration of the microservices or it actually acts as a tool to help with visualizing the pipeline and deployment to Kubernetes, Cloud Foundry, etc. and still work passively outside the pipeline. Therefore, if it is failed for any reason, the pipeline can work without any interruptions.
To clarify what I am asking for, does the combination of Spring Cloud Stream and Spring Cloud Data Flow provide an almost similar approach to what this article refers to it as a best of both worlds of Orchestration and Choreography?
https://www.sapientglobalmarkets.com/blog/big-data-pipeline-orchestration-choreography

Is it ok to connect two camunda instances to the same database?

We are developing a spring boot application(generated with jhipster, with oauth) and we want to use camunda.
The camunda spring boot starter(with the process engine only) worked, however the we had problems with the other two starters(rest, web) in our current setup(although they work with a simple project like in the camunda examples).
We actually prefer using the embedded process engine like this, however, we would like the operational advantages of the camunda webapps.
The preferred solution we thought about was to connect to the same database another process engine(camunda standalone or springboot app with camunda web starter). This seems to be working in our tests.
The other solution would be to use camunda standalone and communicate via rest api, and subscribe to topics for service tasks.
Do you see any problems with the preferred solution?
Yes, it's perfectly fine running two engines against same database. Just make sure to set camunda.bpm.job-execution.enabled=false in the other instance(if you don't want it to pick up and execute jobs)

How to register Spring Batch Application in spring cloud data flow?

I am trying to register Spring bath project jar file in spring cloud data flow. I am pretty new to spring cloud data flow. Please help me step by step process to register Spring batch Job in spring cloud data flow.
There are a few examples in the SCDF-samples repo.
Also, we spend cycles writing the documentation, so please make sure to review the reference guide; in particular the task/batch sections could be useful.

Spring Integration Webservice vs. RestTemplate

I'm trying to learn SI (Spring Integration) but i'm a bit confused on the real usage of this.
As first example i would like to interact with a WebService but i dont understand what could be the difference from
Invoke a WebService Using SI
Invoke a Webservice using RestTemplate
So, what is the benefit of using SI (in Webservice context, or in other context)?
Looking the web, i havent find an article that explain:
Usually you will do in this way....
With SI you can do better - in this another way - and the benefit are....
To be more explicit on what i have to realize, this is an example:
1) I have to write an application (Standalone application) that have to collect some data in the system periodically and then invoke a Web Service that will store it.
2) The Web Service receive the call from the "clients" and store in the database.
My webservice will use REST.
The reason because i've think to use SI is that the Standalone Application should interact with different system
Webservice in first instance
A Web Mail, if the webservice is not achievable
File system if Web mail is not achievable too
If you only need to pull some data in a simple way and push it onwards to a REST service this does not "justify" the use of Spring Integration. A simple Spring (Boot) application combined with a scheduler will be sufficient.
But if you want to use a more complex data source for which an endpoint is available, you need transformations, complex and flexible routing is a high priority or even Enterprise Integration Patterns (EIP) then Spring Integration is for you. Have a look at the Overview and decide if it mentions something you consider as valuable to you.
Perhaps you will create additional value by mixing in Spring Batch if you need to process a lot of data.
But as I understand your current demand starting with just a RESTTemplate should do for the moment. Starting small will not prevent you from switching to Spring Integration later on.
Have a look at the various tutorials and guides provided by the Spring Boot project. There is even an example for Spring Integration.

Resources