Skip to content

Commit

Permalink
add slices in CreateQueue and SetQueueAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
souriki committed Jun 5, 2017
1 parent 8bd3273 commit d4799af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion example/queue_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func main() {
queueManager := ali_mns.NewMNSQueueManager(client)


err := queueManager.CreateSimpleQueue("test")
err := queueManager.CreateQueue("test", 0, 65536, 345600, 30, 0, 3)

if err != nil && !ali_mns.ERR_MNS_QUEUE_ALREADY_EXIST_AND_HAVE_SAME_ATTR.IsEqual(err) {
fmt.Println(err)
Expand Down
14 changes: 7 additions & 7 deletions queue_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

type AliQueueManager interface {
CreateSimpleQueue(queueName string) (err error)
CreateQueue(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32) (err error)
SetQueueAttributes(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32) (err error)
CreateQueue(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32, slices int32) (err error)
SetQueueAttributes(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32, slices int32) (err error)
GetQueueAttributes(queueName string) (attr QueueAttribute, err error)
DeleteQueue(queueName string) (err error)
ListQueue(nextMarker string, retNumber int32, prefix string) (queues Queues, err error)
Expand Down Expand Up @@ -98,10 +98,10 @@ func checkAttributes(delaySeconds int32, maxMessageSize int32, messageRetentionP
}

func (p *MNSQueueManager) CreateSimpleQueue(queueName string) (err error) {
return p.CreateQueue(queueName, 0, 65536, 345600, 30, 0)
return p.CreateQueue(queueName, 0, 65536, 345600, 30, 0, 2)
}

func (p *MNSQueueManager) CreateQueue(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32) (err error) {
func (p *MNSQueueManager) CreateQueue(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32, slices int32) (err error) {
queueName = strings.TrimSpace(queueName)

if err = checkQueueName(queueName); err != nil {
Expand All @@ -122,7 +122,7 @@ func (p *MNSQueueManager) CreateQueue(queueName string, delaySeconds int32, maxM
MessageRetentionPeriod: messageRetentionPeriod,
VisibilityTimeout: visibilityTimeout,
PollingWaitSeconds: pollingWaitSeconds,
Slices: 3,
Slices: slices,
}

var code int
Expand All @@ -136,7 +136,7 @@ func (p *MNSQueueManager) CreateQueue(queueName string, delaySeconds int32, maxM
return
}

func (p *MNSQueueManager) SetQueueAttributes(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32) (err error) {
func (p *MNSQueueManager) SetQueueAttributes(queueName string, delaySeconds int32, maxMessageSize int32, messageRetentionPeriod int32, visibilityTimeout int32, pollingWaitSeconds int32, slices int32) (err error) {
queueName = strings.TrimSpace(queueName)

if err = checkQueueName(queueName); err != nil {
Expand All @@ -157,7 +157,7 @@ func (p *MNSQueueManager) SetQueueAttributes(queueName string, delaySeconds int3
MessageRetentionPeriod: messageRetentionPeriod,
VisibilityTimeout: visibilityTimeout,
PollingWaitSeconds: pollingWaitSeconds,
Slices: 3,
Slices: slices,
}

_, err = send(p.cli, p.decoder, PUT, nil, &message, fmt.Sprintf("queues/%s?metaoverride=true", queueName), nil)
Expand Down

0 comments on commit d4799af

Please sign in to comment.