![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@5minds/processcube_engine_client
Advanced tools
Contains a typescript based client for accessing the Engine.
Ein NodeJS basierter Client zur Kommunikation mit der ProcessCube Engine.
Codebeispiele zur Verwendung des Clients und der External Task Worker finden sich hier.
import { EngineClient } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
const processInstancesInCorrelation = await client.processInstances.query({
correlationid: 'my-correlation-id',
});
Man benötigt lediglich die URL der anzusteuernden Engine. Mit dieser lässt sich eine Instanz des Clients anlegen, die direkt verwendbar ist.
Es gibt verschiedene Wege sich Clients anzulegen.
Man kann eine Instanz des EngineClients
direkt anlegen, welche die API der ProcessCube Engine vollständig abdeckt.
import { EngineClient } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
const processInstancesInCorrelation = await client.processInstances.query({
correlationid: 'my-correlation-id',
});
Oder man kann sich über die Client Factory einen feature-spezifischen Client anlegen, der nur einen besimmten fachlichen Aspekt der ProcessCube Engine abdeckt.
Beispiel:
import { ClientFactory } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const processInstanceClient = ClientFactory.createProcessInstanceClient(engineUri);
const processInstances = await processInstanceClient.query({
correlationid: 'my-correlation-id',
});
Hier wird eine Client Instanz angelegt, welche lediglich die Interaktion mit Prozessinstanzen abdeckt.
Nachfolgend werden ein paar der am häufigsten verwendeten Use Cases demonstriert.
Das Starten von Prozessinstanzen kann über die EngineClient.processModels
Fachlichkeit realisiert werden.
Prozesse lassen sich auf mehrere Arten starten.
import { EngineClient } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
await client.processModels.startProcessInstance({ processModelId: 'myProcessModelId' });
Die processModelId
ist der einzige erforderliche Parameter für diesen Request.
Der Client wartet in diesem Szenario nur, bis die Engine den Start des Prozesses bestätigt hat.
Neben der processModelId
können folgende Paramter mitgegeben werden:
startEventId
: Die ID des Start Events von welchem aus der Prozess losgehen soll
correlationId
: Gibt an, in welcher Correlation die Prozessinstanz laufen sollinitialToken
: Der JSON-formatierte Prozess-Token, den die Prozessinstanz zu beginn besitzen sollimport { EngineClient } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
await client.processModels.startProcessInstance({
processModelId: 'myProcessModelId',
startEventId: 'StartEvent_1',
correlationId: 'MyCorrelatioNid',
initialToken: {
hello: 'world',
},
});
import { EngineClient } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
await client.processModels.startProcessInstanceAndAwaitEndEvent({ processModelId: 'myProcessModelId' });
Hier wartet der Client, bis die Engine den Prozess bis zum Ende ausgeführt hat.
Die Methode akzeptiert dieselben Parameter wie processModels.startProcessInstance
.
Abfragen aller User Tasks eines bestimmten Prozesses, die sich in einem "suspended" State befinden:
import { EngineClient, DataModels } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
const userTasks = await client.userTasks.query({
processModelId: 'myProcessModelId',
state: DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended,
});
console.log(userTasks);
External Task Worker werden dazu benutzt, um die an einer Prozessinstanz anfallenden External Service Tasks
zu verarbeiten.
Ein Worker benötigt minimal die folgenden 3 Einstellungen
Beispiel:
import { ExternalTaskWorker } from '@5minds/processcube_engine_client';
interface AddPayload {
number1: number;
number2: number;
}
interface AddResult {
sum: number;
}
const engineUri = 'http://localhost:10560';
const topic = 'sum_numbers';
const externalTaskWorker = new ExternalTaskWorker<AddPayload, AddResult>(url, topic, doAdd, config);
externalTaskWorker.start();
async function doAdd(payload: AddPayload, externalTask: DataModels.ExternalTasks.ExternalTask<AddPayload>): Promise<AddResult> {
const result: AddResult = {
sum: payload.number1 + payload.number2,
};
return result;
}
Der Worker lässt sich mit folgendem Befehl starten:
externalTaskWorker.start();
und mit folgendem Befehl stoppen:
externalTaskWorker.stop();
Ein ausführbares Code-Beispiel findet sich hier.
FAQs
Contains a typescript based client for accessing the Engine.
The npm package @5minds/processcube_engine_client receives a total of 587 weekly downloads. As such, @5minds/processcube_engine_client popularity was classified as not popular.
We found that @5minds/processcube_engine_client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 29 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.