Skip to content
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
2 changes: 1 addition & 1 deletion .ci/ubuntu/gha-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -o xtrace
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
readonly script_dir
echo "[INFO] script_dir: '$script_dir'"
readonly rabbitmq_image=rabbitmq:4.1-management-alpine
readonly rabbitmq_image=rabbitmq:4.2-rc-management-alpine


readonly docker_name_prefix='rabbitmq-amqp-go-client'
Expand Down
20 changes: 19 additions & 1 deletion pkg/rabbitmqamqp/amqp_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ type StreamFilterOptions struct {

// Filter the data based on Message Properties
Properties *amqp.MessageProperties

// SQLFilter
SQL string
}

/*
Expand Down Expand Up @@ -202,6 +205,10 @@ func (sco *StreamConsumerOptions) linkFilters() []amqp.LinkFilter {
var filters []amqp.LinkFilter

filters = append(filters, sco.Offset.toLinkFilter())
if sco.StreamFilterOptions != nil && !isStringNilOrEmpty(&sco.StreamFilterOptions.SQL) {

}

if sco.StreamFilterOptions != nil && sco.StreamFilterOptions.Values != nil {
var l []any
for _, f := range sco.StreamFilterOptions.Values {
Expand Down Expand Up @@ -287,11 +294,22 @@ func (sco *StreamConsumerOptions) id() string {
}

func (sco *StreamConsumerOptions) validate(available *featuresAvailable) error {
if sco.StreamFilterOptions != nil && sco.StreamFilterOptions.Properties != nil {
if sco.StreamFilterOptions == nil {
return nil
}

if sco.StreamFilterOptions.Properties != nil {
if !available.is41OrMore {
return fmt.Errorf("stream consumer with properties filter is not supported. You need RabbitMQ 4.1 or later")
}
}

if !isStringNilOrEmpty(&sco.StreamFilterOptions.SQL) {
if !available.is42rMore {
return fmt.Errorf("stream consumer with SQL filter is not supported. You need RabbitMQ 4.2 or later")
}
return nil
}
return nil
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/rabbitmqamqp/features_available.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func (v Version) Compare(other Version) int {
type featuresAvailable struct {
is4OrMore bool
is41OrMore bool
is42rMore bool
isRabbitMQ bool
}

Expand All @@ -45,6 +46,7 @@ func (f *featuresAvailable) ParseProperties(properties map[string]any) error {

f.is4OrMore = isVersionGreaterOrEqual(version, "4.0.0")
f.is41OrMore = isVersionGreaterOrEqual(version, "4.1.0")
f.is42rMore = isVersionGreaterOrEqual(version, "4.2.0")
f.isRabbitMQ = strings.EqualFold(properties["product"].(string), "RabbitMQ")
return nil
}
Expand Down