EventSubscription Configuration

Configure event subscriptions to receive events from channels

EventSubscription Configuration

Defines a subscription to an event channel, enabling integration flows to receive and process events.

Schema Properties

PropertyTypeRequiredDefaultDescription
SourcestringYes-Name of the event source to subscribe to
ChannelstringYes-Name of the event channel to subscribe to

YAML Examples

Basic Event Subscription

apiVersion: weik.io/v1
kind: EventSubscription
metadata:
  name: order-events-subscription
spec:
  Source: order-processing
  Channel: orders-channel

Multiple Subscriptions

apiVersion: weik.io/v1
kind: EventSubscription
metadata:
  name: customer-created-subscription
spec:
  Source: crm-system
  Channel: customer-events
---
apiVersion: weik.io/v1
kind: EventSubscription
metadata:
  name: inventory-updated-subscription
spec:
  Source: inventory-system
  Channel: inventory-events
---
apiVersion: weik.io/v1
kind: EventSubscription
metadata:
  name: payment-processed-subscription
spec:
  Source: payment-gateway
  Channel: payment-events

Database Change Tracking Subscription

apiVersion: weik.io/v1
kind: EventSubscription
metadata:
  name: products-table-subscription
spec:
  Source: northwind-database
  Channel: product-changes

External System Subscription

apiVersion: weik.io/v1
kind: EventSubscription
metadata:
  name: webhook-events-subscription
spec:
  Source: external-webhooks
  Channel: webhook-notifications

Usage Notes

EventSubscription configurations connect integration flows to event channels, allowing flows to react to events from various sources.

Event Flow

  1. An event source generates events
  2. Events are sent to an event channel
  3. Subscribers receive events from the channel
  4. Integration flows process the events

Source and Channel References

The Source and Channel properties must reference existing EventSource and EventChannel configurations. Ensure these resources are created before creating subscriptions.

Example dependency chain:

# 1. Define the event channel
apiVersion: weik.io/v1
kind: EventChannel
metadata:
  name: orders-channel
spec:
  Type: memory
---
# 2. Define the event source
apiVersion: weik.io/v1
kind: EventSource
metadata:
  name: order-processing
spec:
  Type: webhook
  EventType: com.example.order
  EventSource: order-api
---
# 3. Create subscription
apiVersion: weik.io/v1
kind: EventSubscription
metadata:
  name: order-subscription
spec:
  Source: order-processing
  Channel: orders-channel

Use Cases

  • Process database changes in real-time
  • React to external webhook notifications
  • Trigger workflows based on system events
  • Implement event-driven integration patterns
  • Coordinate between microservices

Best Practices

  • Use descriptive names that indicate the event type and purpose
  • Create separate subscriptions for different event types
  • Ensure event sources and channels exist before creating subscriptions
  • Monitor subscription health and event processing
  • Handle event processing failures gracefully in your integration flows