@@ -45,9 +45,17 @@ func (c *Cluster) deleteStreams() error {
4545 return nil
4646 }
4747
48- err = c .KubeClient .FabricEventStreams (c .Namespace ).Delete (context .TODO (), c .Name , metav1.DeleteOptions {})
49- if err != nil {
50- return fmt .Errorf ("could not delete event stream custom resource: %v" , err )
48+ errors := make ([]string , 0 )
49+ for _ , appId := range c .streamApplications {
50+ fesName := fmt .Sprintf ("%s-%s" , c .Name , appId )
51+ err = c .KubeClient .FabricEventStreams (c .Namespace ).Delete (context .TODO (), fesName , metav1.DeleteOptions {})
52+ if err != nil {
53+ errors = append (errors , fmt .Sprintf ("could not delete event stream %q: %v" , fesName , err ))
54+ }
55+ }
56+
57+ if len (errors ) > 0 {
58+ return fmt .Errorf ("could not delete all event stream custom resources: %v" , strings .Join (errors , `', '` ))
5159 }
5260
5361 return nil
@@ -265,6 +273,11 @@ func (c *Cluster) syncStreams() error {
265273 return nil
266274 }
267275
276+ // fetch different application IDs from streams section
277+ // there will be a separate event stream resource for each ID
278+ appIds := gatherApplicationIds (c .Spec .Streams )
279+ c .streamApplications = appIds
280+
268281 slots := make (map [string ]map [string ]string )
269282 publications := make (map [string ]map [string ]acidv1.StreamTable )
270283
@@ -329,9 +342,7 @@ func (c *Cluster) syncStreams() error {
329342}
330343
331344func (c * Cluster ) createOrUpdateStreams () error {
332-
333- appIds := gatherApplicationIds (c .Spec .Streams )
334- for _ , appId := range appIds {
345+ for _ , appId := range c .streamApplications {
335346 fesName := fmt .Sprintf ("%s-%s" , c .Name , appId )
336347 effectiveStreams , err := c .KubeClient .FabricEventStreams (c .Namespace ).Get (context .TODO (), fesName , metav1.GetOptions {})
337348 if err != nil {
0 commit comments