Multistream

The Devprime platform, through the Stream Adapter, offers the Multistream approach, allowing the integration of more than one Stream service into a single microservice.

By adopting the Multistream strategy through the configuration of the Stream Adapter, it is possible to activate, for example, RabbitMQ and Kafka at the same time to meet specific scenarios. All events received by the Stream Adapter are processed in the StreamEvents() method offered by the Stream Adapter on the Devprime platform.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 "Devprime_Stream": [
    {
      "Alias": "Stream1",
      "Enable": "true",
      "Default": "fakse",
      "StreamType": "RabbitMQ",
      "HostName": "Localhost",
      "User": "guest",
      "Password": "guest",
      "Port": "5672",
      "Exchange": "devprime",
      "ExchangeType": "direct",
      "Retry": "3",
      "Fallback": "State1",
      "Threads": "30",
      "Buffer": "5",
      "Subscribe": []
    },
    {
      "Alias": "Stream2",
      "Enable": "true",
      "Default": "true",
      "StreamType": "Kafka",
      "Hostname": "Localhost",
      "Port": "9092",
      "User": "",
      "Password": "",
      "Retry": "3",
      "Fallback": "State1",
      "Subscribe":[]
    }
  ],

Example in the application log with this configuration:

1
2
[INF][Stream][Type "RabbitMQ"][Alias "Stream1"]["Enable"]
[INF][Stream][Type "Kafka"][Alias "Stream2"]["Enable"]

YAML example with application settings:
To export the configurations as an environment variable and use in Kubernetes, run the command in the Devprime CLI:
dp export kubernetes

1
2
3
4
5
6
7
8
- name: devprime_stream1
  value: "alias=Stream1|||enable=true|||default=true|||streamtype=RabbitMQ|||
  hostname=rabbitmq.default.svc|||user=guest|||password=guest|||port=5672|||
  exchange=devprime|||exchangetype=direct|||retry=3|||fallback=State1|||
  threads=30|||buffer=1" 
- name: devprime_stream2
  value: "alias=Stream2|||enable=true|||default=false|||streamtype=Kafka|||
  hostname=kafka.default.svc|||port=9092|||retry=3|||fallback=State1"
Last modified October 17, 2023 (e38ae05b)