HTTP Client

HTTP Client

ID: uniflow.plugin.httpclient Category: Web & Messaging Services Version: v1.4.0 Min Uniflow Version: Uniflow ≥ v1.4.0

HTTP Client Plugin Reference Manual

1. Overview

Plugin Name: HTTP Client

Type: Network Protocol & Web Services

Identifier: uniflow.plugin.httpclient

Version: 1.4.0

Description

Executes high-performance, non-blocking HTTP and HTTPS requests against external REST APIs and web services. Features an asynchronous decoupled queue architecture that prevents blocking visual rule gates during network round-trips, supports parallel request execution workers, allows custom correlation Payload strings on sink nodes, and generates "Request Done" system events with detailed response metrics and echoed payloads.


2. Technical Architecture

The HTTP Client plugin executes RESTful web service requests over HTTP and HTTPS connections. It manages pooled sockets, handles Bearer Token, Basic Authentication, and custom API Key header injection, supports SSL/TLS certificate bypass options for internal endpoints, and automatically converts responses into strongly typed catalog values.

Decoupled Request & Answer Architecture

In industrial automation workflows, rule execution gates must evaluate at sub-millisecond speeds. Synchronous HTTP network calls over WAN, cellular, or cloud connections can introduce latency ranging from 50 milliseconds to tens of seconds, causing rule gates to stall. Version 1.4.0 decouples HTTP request dispatching from response handling across two critical dimensions:

1. Non-Blocking Point Polling (Inputs):

  • Polling endpoints are continuously monitored in a dedicated background task (RunPollLoopAsync).
  • When a rule node reads a polled point as an input (OnReadAsync), the adapter returns the latest cached payload and status code immediately from memory, avoiding inline network latency.
  • 2. Non-Blocking Point Writes & Commands (Outputs / Sinks):

  • Writing to an HTTP point (e.g., POST, PUT, DELETE, PATCH) or invoking cmd:{point.Id} / http:request does not await the remote HTTP response.
  • The outbound request is enqueued into a bounded channel queue (Channel<HttpOutboundRequestItem>) with configurable capacity (default: 1,000 items).
  • The sink call completes immediately (< 1 ms), releasing the visual rule gate without delay.
  • 3. Parallel Execution Workers:

  • A pool of concurrent worker tasks (default: 10 parallel workers, configurable via ParallelWorkers) continuously consumes requests from the bounded channel.
  • Requests are executed concurrently using HttpClientFactory and pooled sockets, maximizing throughput.
  • 4. Sink Node Correlation Payload:

  • Outbound sink points accept an optional Payload string argument. If the rule passes a JSON object (e.g., {"Body": "{\"val\": 42}", "Payload": "BATCH-9021"}), the adapter separates the request body from the correlation payload.
  • The payload travels through the worker queue alongside the request and is preserved even in the event of timeouts or HTTP network errors.
  • 5. Asynchronous System Event: "Request Done" (http.request_done):

  • Upon completion of the HTTP transaction (both 2xx successes and 4xx/5xx/network errors), the plugin dispatches an event snapshot to the Uniflow Rule Engine.
  • Event listeners receive the complete request metadata, response status code, response body, execution duration, error message, and the echoed correlation Payload.

  • System Interaction & Exposed Catalog Routes

    Catalog Routes & Node Integration

    Input Event Triggers (Event Input Nodes):

  • Request Done (http.request_done): Emitted whenever an asynchronous outbound HTTP request finishes. Contains request details, HTTP status code, response body, duration, and the echoed correlation Payload.
  • http.response_received: Emitted upon successful HTTP response arrival.
  • http.request_failed: Emitted when an HTTP request times out or returns an error.
  • http.status_code_changed: Monitored HTTP status code update.
  • Executable Actions (Output Target / Action Nodes):

  • Writable Points (POST, PUT, DELETE): Sends HTTP request asynchronously; accepts Body and Payload.
  • http:request (HTTP Request Action): Issues dynamic HTTP requests with custom headers, body, and Payload.
  • cmd:{point.Id}: Triggers an individual point execution with optional Body and Payload.
  • Architecture Diagram

    VISUAL ARCHITECTURE FLOW DIAGRAM
    Rendering Flow Architecture Diagram...

    3. Configuration Parameters

    The following configuration parameters can be configured for the HTTP Client source:

    Configuration SettingKeyTypeDefaultDescription
    Base URL  BaseUrl
    String""Base address for all relative endpoint URLs (e.g., https://api.example.com).
    Connect Timeout (ms)  ConnectTimeoutMs
    Int3210000Socket connection and request timeout in milliseconds.
    Reconnect Delay (ms)  ReconnectDelayMs
    Int325000Delay before retrying after communication faults.
    Queue Capacity  QueueCapacity
    Int321000Maximum number of outbound HTTP requests held in the in-memory queue.
    Parallel Workers  ParallelWorkers
    Int3210Number of concurrent worker tasks executing outbound HTTP requests.
    Auth Mode  AuthMode
    String"None"Authentication mechanism (None, Basic, Bearer, ApiKey, CustomHeader).
    Username  Username
    String""Username for Basic Authentication.
    Password  Password
    String""Password for Basic Authentication (secure field).
    Auth Token  AuthToken
    String""Bearer token or token credential.
    Header Name  HeaderName
    String""Header key for API key or custom header authentication (e.g. X-API-Key).
    API Key Value  ApiKeyValue
    String""Key value associated with HeaderName.
    Custom Headers (JSON)  CustomHeadersJson
    String""JSON dictionary of static HTTP headers applied to all requests.

    4. Exposed Routes & Data Types

    Input Source (Polled Points)

    The Input Source node reads response payloads and HTTP status codes from configured pollable HTTP endpoints. Reads are served instantaneously from local memory.

    Human-Readable Field NameItem IDData TypeDescription
    Configured HTTP Endpoint  {PointId}
    String / Json / Double / Int32 / BoolPolled response payload value from remote REST endpoint.
    Endpoint Status Code  {PointId}_status
    Int32HTTP status code integer (e.g., 200 OK, 404 Not Found, 500 Error).
    Last Response Payload  http:last_response
    StringPayload body of the most recently finished request.
    Last Response Code  http:last_response_code
    Int32HTTP status code of the most recently finished request.

    Event Input: "Request Done" (http.request_done)

    Emitted whenever an asynchronous outbound HTTP request finishes execution. Triggers reactive rule execution with the following fields:

    Field NameData TypeDescription
    PointId  String
    Identifier of the point or command that originated the request.
    PointName  String
    Human-readable name of the target point or action.
    Method  String
    HTTP method executed (GET, POST, PUT, DELETE, PATCH).
    Url  String
    Full destination URL of the HTTP call.
    StatusCode  Int32
    HTTP status code returned by the server (200, 201, 400, 500, or 0 on network failure).
    Success  Bool
    true if the HTTP status is 2xx and no network exception occurred; otherwise false.
    Error  String
    Error message, DNS failure, or HTTP exception details if the call failed.
    Response  String
    Full response body returned by the HTTP server.
    Payload  String
    The correlation payload string passed to the sink node when the request was initiated.
    DurationMs  Int64
    Total elapsed execution time in milliseconds for the HTTP request.
    Timestamp  DateTime
    UTC timestamp when the request finished.

    Output Target (Action / Sink Nodes)

    The Output Target node writes data to HTTP points or sends parameterized HTTP requests. All write actions return immediately (< 1 ms).

    Target NameTarget IDParameterTypeRequiredDescription
    Writable Point  {PointId}
    BodyStringFalseRequest body payload (JSON, text, XML) or query string.
    PayloadStringFalseCorrelation payload echoed back in the "Request Done" event.
    HTTP Request Action  http:request
    MethodStringTrueHTTP Method (POST, PUT, DELETE, GET).
    UrlStringFalseOptional URL path override relative to BaseUrl.
    BodyStringFalseHTTP request body content.
    PayloadStringFalseCorrelation payload echoed back in the "Request Done" event.
    TIP

    Sink parameters can be supplied as individual properties or combined in a JSON string, e.g.:

    {"Body": "{\"orderId\": 101, \"qty\": 5}", "Payload": "TXN-88412"}.


    5. Usage Examples

    Scenario A: Weather REST API Telemetry Poller Updates Modbus Register

    Workflow Overview:

    The HTTP Client periodically polls an external weather REST endpoint (https://api.weather.local/v1/solar-radiation). The rule reads the cached value without waiting for network I/O, evaluates solar radiation thresholds, and updates a local Modbus holding register.

    Rule Node Configuration:

    1. Input Source Node: HTTP Client Poller

  • Endpoint URL: https://api.weather.local/v1/solar-radiation
  • Exposed Field: solar_radiation (Json)
  • 2. Logic Filter Node: JSON Path & GreaterThan

  • Path: $.radiation_watts (Double)
  • Evaluation: radiation_watts > 850.0
  • 3. Output Target Node: Modbus Client Writer

  • Action Target: Direct Access
  • Type: Holding Register
  • Address: 202
  • Value: 1
  • Logic Flow Diagram:

    VISUAL ARCHITECTURE FLOW DIAGRAM
    Rendering Flow Architecture Diagram...

    Scenario B: Avigilon Motion Detection Non-Blocking Incident POST

    Workflow Overview:

    When an Avigilon camera detects motion, Uniflow immediately formats an incident payload and issues an asynchronous HTTP POST request (http:request). Because the write call is non-blocking, the motion event gate is released in microseconds.

    Rule Node Configuration:

    1. Event Input Node: Avigilon ACC Listener

  • Event Code: DEVICE_MOTION_START
  • Exposed Fields: CameraName (String), Timestamp (DateTime)
  • 2. Logic Formatter Node: JSON Builder

  • Template: {"event": "MOTION_DETECTED", "camera": "${CameraName}"}
  • 3. Output Target Node: HTTP Client Action

  • Target: http:request
  • Method: POST
  • Body: Formatted JSON payload
  • Payload: CameraName
  • Logic Flow Diagram:

    VISUAL ARCHITECTURE FLOW DIAGRAM
    Rendering Flow Architecture Diagram...

    Scenario C: Decoupled REST Action with Correlation Payload & "Request Done" Handling

    Workflow Overview:

    A barcode scanner triggers a production batch submission via an HTTP PUT call to a Cloud ERP API. A correlation tag (BATCH-2026-X) is passed in the Payload sink parameter. When the cloud server responds, the "Request Done" event is received by a second rule, inspecting StatusCode and persisting the response along with the echoed Payload into Internal Storage.

    Logic Flow Diagram:

    VISUAL ARCHITECTURE FLOW DIAGRAM
    Rendering Flow Architecture Diagram...

    Rule 1 (Outbound Submission):

  • Input: Barcode Scanner Event (BatchId).
  • Sink Node: HTTP Client -> Point ERP_Batch_Submit (PUT).
  • Body: {"batch": "${BatchId}", "operator": "User01"}
  • Payload: ${BatchId}
  • Rule 2 (Asynchronous Completion Handling):

  • Event Input Node: HTTP Client -> Request Done.
  • Exposed Fields: Payload (String), StatusCode (Int32), Success (Bool), Response (String), DurationMs (Int64).
  • Condition Node: Success is true.
  • Target Node: Internal Storage -> Write to Batch_Status_${Payload} with value Response.
  • Architecture Flow Diagram — Full Preview