Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.11] Bug OCPBUGS-3295: Event Pull Status Notification GET Method not working as per o-Ran spec #58

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
32 changes: 28 additions & 4 deletions pkg/channel/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,44 @@ package channel

import (
cloudevents "github.com/cloudevents/sdk-go/v2"
"github.com/google/uuid"
)

// DataChan ...
type DataChan struct {
Address string
Data *cloudevents.Event
Status Status
ID string
ClientID uuid.UUID
Address string
Data *cloudevents.Event
Status Status
//Type defines type of data (Notification,Metric,Status)
Type Type
// OnReceiveFn to do on OnReceive
OnReceiveFn func(e cloudevents.Event)
// OnReceiveOverrideFn Optional for event, but override for status pings.This is an override function on receiving msg by amqp listener,
// if not set then the data is sent to out channel and processed by side car default method
// if not set then the data is sent to out channel and processed by side-car default method
OnReceiveOverrideFn func(e cloudevents.Event, dataChan *DataChan) error
// ProcessEventFn Optional, this allows to customize message handler thar was received at the out channel
ProcessEventFn func(e interface{}) error
// Only for status lost if marshalled to json
StatusChan chan<- *StatusChan
ReturnAddress *string
}

// StatusChan channel used for writing status data out here
type StatusChan struct {
ID string
ClientID uuid.UUID
Data *cloudevents.Event
}

// CreateCloudEvents ...
func (d *DataChan) CreateCloudEvents(dataType string) (*cloudevents.Event, error) {
ce := cloudevents.NewEvent(cloudevents.VersionV03)
ce.SetDataContentType(cloudevents.ApplicationJSON)
ce.SetSpecVersion(cloudevents.VersionV03)
ce.SetType(dataType)
ce.SetSource(d.Address)
ce.SetID(d.ClientID.String())
return &ce, nil
}
10 changes: 5 additions & 5 deletions pkg/channel/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ func (s Status) String() string {
type Type int

const (
// LISTENER the type to create listener
LISTENER Type = iota
//SENDER the type is to create sender
SENDER
// SUBSCRIBER the type to create listener
SUBSCRIBER Type = iota
//PUBLISHER the type is to create sender
PUBLISHER
//EVENT the type is an event
EVENT
//STATUS the type is an STATUS CHECK
Expand All @@ -49,5 +49,5 @@ const (

// String represent of Type enum
func (t Type) String() string {
return [...]string{"LISTENER", "SENDER", "EVENT", "STATUS"}[t]
return [...]string{"SUBSCRIBER", "PUBLISHER", "EVENT", "STATUS"}[t]
}
Loading