Application Orchestrator
Relevant source files
The following files were used as context for generating this wiki page:
The Application Orchestrator serves as the central coordination layer for the flext-target-oracle-oic integration, managing the lifecycle of Singer target operations for Oracle Integration Cloud (OIC). It defines the entry points for processing data streams, managing authentication, and facilitating communication between the Singer SDK and the OIC API.
The orchestrator is implemented as a thin facade that leverages the FLEXT framework's Method Resolution Order (MRO) to inherit base functionality from FlextMeltanoTargetServiceBase. Its primary responsibility is the domain-specific creation and management of sinks for various OIC resources such as connections, integrations, packages, and lookups.
Sources: src/flext_target_oracle_oic/api.py:1-20, src/flext_target_oracle_oic/application/orchestrator.py:1-5
Core Service Architecture
The primary entry point for the application is the FlextTargetOracleOicService, which acts as the high-level orchestrator. This class is responsible for resolving the appropriate sink for incoming data based on the stream name and schema provided by the Singer source.
The diagram above illustrates how the Service facade delegates sink creation to the underlying target implementation.
Sources: src/flext_target_oracle_oic/api.py:23-42, src/flext_target_oracle_oic/target.py:61-78
Service Entry Point
The FlextTargetOracleOicService (also aliased as target_oracle_oic) overrides the create_sink method to delegate runtime sink creation to a service runtime utility. This ensures that stream-specific logic is applied during the data ingestion process.
Sources: src/flext_target_oracle_oic/api.py:34-42
Singer Target and Sink Management
The orchestrator manages data flow through specialized Sink classes. All sinks inherit from FlextTargetOracleOicBaseSink, which provides standard Singer batch and record processing hooks.
| Class Name | Managed Stream | Description |
|---|---|---|
FlextTargetOracleOicConnectionsSink | connections | Handles OIC Connection resource ingestion. |
FlextTargetOracleOicIntegrationsSink | integrations | Handles OIC Integration resource ingestion. |
FlextTargetOracleOicPackagesSink | packages | Handles OIC Package resource ingestion. |
FlextTargetOracleOicLookupsSink | lookups | Handles OIC Lookup resource ingestion. |
Sources: src/flext_target_oracle_oic/target.py:37-58, src/flext_target_oracle_oic/target.py:68-73
Sink Resolution Logic
The orchestrator uses a mapping-based resolution strategy to select the correct sink. If a stream name is not explicitly defined in the _sink_classes registry, it defaults to the FlextTargetOracleOicBaseSink.
This sequence ensures that the orchestrator remains extensible for new OIC resource types.
Sources: src/flext_target_oracle_oic/target.py:75-78
Authentication Orchestration
The orchestrator includes a dedicated Authenticator within the utilities namespace to manage OAuth2 tokens for Oracle Integration Cloud. This component handles the lifecycle of the access_token, including payload construction and interaction with the OIC identity service.
Authentication Data Flow
The authenticator builds a token request using client_credentials and manages optional parameters like scope and audience based on the provided configuration.
Key Authentication Methods
get_access_token(): Resolves a valid token, performing a network request if the cache is empty or a refresh is forced.build_token_request_data(): Constructs the JSON payload includinggrant_type,client_id, andclient_secret.auth_headers: Returns a mapping containing theAuthorizationheader formatted with the appropriate scheme (e.g., Bearer).
Sources: src/flext_target_oracle_oic/utilities.py:81-99
Model Validation and Factories
The Orchestrator utilizes Pydantic-based models to ensure data integrity before sending payloads to OIC. The FlextTargetOracleOicUtilities class provides factory methods to instantiate these models from raw Singer records.
| Factory Method | Model Produced | Key Validation Fields |
|---|---|---|
create_oic_connection | OICConnection | id, name, adapter_type, properties |
create_oic_integration | OICIntegration | id, name, version, pattern |
create_oic_package | OICPackage | id, name, version |
create_oic_lookup | OICLookup | name, columns, rows |
Sources: src/flext_target_oracle_oic/utilities.py:40-66, src/flext_target_oracle_oic/models.py:17-64
Lifecycle Entry Points
The Application Orchestrator defines specific lifecycle hooks that the Singer SDK invokes during execution.
def setup(self) -> p.Result[bool]:
"""Setup target resources."""
return r[bool].ok(value=True)
def teardown(self) -> p.Result[bool]:
"""Teardown target resources."""
return r[bool].ok(value=True)
Sources: src/flext_target_oracle_oic/target.py:80-86
Configuration Validation
Before operation, the orchestrator validates the presence of critical configuration keys: base_url, oauth_client_id, and oauth_client_secret. This prevents runtime failures during API interactions.
Sources: src/flext_target_oracle_oic/utilities.py:31-38
Conclusion
The Application Orchestrator is the central hub for the Oracle OIC target, abstracting complex OAuth2 flows and resource-specific sink logic into a cohesive service layer. By leveraging the FLEXT framework's lazy loading and model-driven architecture, it provides a performant and type-safe environment for moving data into Oracle Integration Cloud.
Sources: src/flext_target_oracle_oic/application/init.py, src/flext_target_oracle_oic/api.py