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

Attach dls station #125

Merged
merged 7 commits into from
Sep 19, 2023
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ s1, err = c.CreateStation("<station-name>",
memphis.SchemaName(<string>),
memphis.SendPoisonMsgToDls(<bool>), // defaults to true
memphis.SendSchemaFailedMsgToDls(<bool>), // defaults to true
memphis.TieredStorageEnabled(<bool>) // defaults to false
memphis.PartitionsNumber(<int>) // default is 1 partition
memphis.TieredStorageEnabled(<bool>), // defaults to false
memphis.PartitionsNumber(<int>), // default is 1 partition
memphis.DlsStation(<string>) // defaults to "" (no DLS station) - If selected DLS events will be sent to selected station as well
)
```

Expand Down
14 changes: 14 additions & 0 deletions station.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type Station struct {
DlsConfiguration dlsConfiguration
TieredStorageEnabled bool
PartitionsNumber int
DlsStation string
}

// RetentionType - station's message retention type
Expand Down Expand Up @@ -91,6 +92,7 @@ type createStationReq struct {
Username string `json:"username"`
TieredStorageEnabled bool `json:"tiered_storage_enabled"`
PartitionsNumber int `json:"partitions_number"`
DlsStation string `json:"dls_station"`
}

type removeStationReq struct {
Expand All @@ -111,6 +113,7 @@ type StationOpts struct {
SendSchemaFailedMsgToDls bool
TieredStorageEnabled bool
PartitionsNumber int
DlsStation string
}

type dlsConfiguration struct {
Expand All @@ -134,6 +137,7 @@ func GetStationDefaultOptions() StationOpts {
SendSchemaFailedMsgToDls: true,
TieredStorageEnabled: false,
PartitionsNumber: 1,
DlsStation: "",
}
}

Expand Down Expand Up @@ -173,6 +177,7 @@ func (opts *StationOpts) createStation(c *Conn) (*Station, error) {
},
TieredStorageEnabled: opts.TieredStorageEnabled,
PartitionsNumber: opts.PartitionsNumber,
DlsStation: opts.DlsStation,
}

if s.PartitionsNumber == 0 {
Expand Down Expand Up @@ -216,6 +221,7 @@ func (s *Station) getCreationReq() any {
Username: s.conn.username,
TieredStorageEnabled: s.TieredStorageEnabled,
PartitionsNumber: s.PartitionsNumber,
DlsStation: s.DlsStation,
}
}

Expand Down Expand Up @@ -318,6 +324,14 @@ func TieredStorageEnabled(tieredStorageEnabled bool) StationOpt {
}
}

// DlsStation - If selected DLS events will be sent to selected station as well
func DlsStation(name string) StationOpt {
return func(opts *StationOpts) error {
opts.DlsStation = name
return nil
}
}

// Station schema updates related

type stationUpdateSub struct {
Expand Down
Loading