Skip to content

Commit

Permalink
Merge pull request #44 from matrober-uk/message-properties
Browse files Browse the repository at this point in the history
Support for message properties
  • Loading branch information
matrober-uk authored Jan 2, 2022
2 parents 42f4777 + b6f5f71 commit e84ce0e
Show file tree
Hide file tree
Showing 9 changed files with 2,226 additions and 19 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ your own error handling or logging.
* Send/receive a slice of bytes (BytesMessage) - [bytesmessage_test.go](bytesmessage_test.go)
* Receive with wait [receivewithwait_test.go](receivewithwait_test.go)
* Send a message as Persistent or NonPersistent - [deliverymode_test.go](deliverymode_test.go)
* Set a message property of type string, int, double or boolean - [messageproperties_test.go](messageproperties_test.go)
* Get by CorrelationID - [getbycorrelid_test.go](getbycorrelid_test.go)
* Request/reply messaging pattern - [requestreply_test.go](requestreply_test.go)
* Send and receive under a local transaction - [local_transaction_test.go](local_transaction_test.go)
Expand Down
8 changes: 4 additions & 4 deletions bytesmessage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestBytesMessageNilBody(t *testing.T) {
assert.Equal(t, 0, msg2.GetBodyLength())
assert.Equal(t, []byte{}, *msg2.ReadBytes())
default:
assert.Fail(t, "Got something other than a text message")
assert.Fail(t, "Got something other than a bytes message")
}

}
Expand Down Expand Up @@ -138,7 +138,7 @@ func TestBytesMessageWithBody(t *testing.T) {
assert.Equal(t, len(msgBody), msg2.GetBodyLength())
assert.Equal(t, msgBody, *msg2.ReadBytes())
default:
assert.Fail(t, "Got something other than a text message")
assert.Fail(t, "Got something other than a bytes message")
}

}
Expand Down Expand Up @@ -186,7 +186,7 @@ func TestBytesMessageInitWithBytes(t *testing.T) {
assert.Equal(t, len(msgBody), msg2.GetBodyLength())
assert.Equal(t, msgBody, *msg2.ReadBytes())
default:
assert.Fail(t, "Got something other than a text message")
assert.Fail(t, "Got something other than a bytes message")
}

}
Expand Down Expand Up @@ -231,7 +231,7 @@ func TestBytesMessageProducerSendBytes(t *testing.T) {
assert.Equal(t, 13, msg2.GetBodyLength())
assert.Equal(t, msgBody, *msg2.ReadBytes())
default:
assert.Fail(t, "Got something other than a text message")
assert.Fail(t, "Got something other than a bytes message")
}

}
Expand Down
42 changes: 42 additions & 0 deletions jms20subset/Message.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,46 @@ type Message interface {
// Typical values returned by this method include
// jms20subset.DeliveryMode_PERSISTENT and jms20subset.DeliveryMode_NON_PERSISTENT
GetJMSDeliveryMode() int

// SetStringProperty enables an application to set a string-type message property.
//
// value is *string which allows a nil value to be specified, to unset an individual
// property.
SetStringProperty(name string, value *string) JMSException

// GetStringProperty returns the string value of a named message property.
// Returns nil if the named property is not set.
GetStringProperty(name string) (*string, JMSException)

// SetIntProperty enables an application to set a int-type message property.
SetIntProperty(name string, value int) JMSException

// GetIntProperty returns the int value of a named message property.
// Returns 0 if the named property is not set.
GetIntProperty(name string) (int, JMSException)

// SetDoubleProperty enables an application to set a double-type (float64) message property.
SetDoubleProperty(name string, value float64) JMSException

// GetDoubleProperty returns the double (float64) value of a named message property.
// Returns 0 if the named property is not set.
GetDoubleProperty(name string) (float64, JMSException)

// SetBooleanProperty enables an application to set a bool-type message property.
SetBooleanProperty(name string, value bool) JMSException

// GetBooleanProperty returns the bool value of a named message property.
// Returns false if the named property is not set.
GetBooleanProperty(name string) (bool, JMSException)

// PropertyExists returns true if the named message property exists on this message.
PropertyExists(name string) (bool, JMSException)

// GetPropertyNames returns a slice of strings containing the name of every message
// property on this message.
// Returns a zero length slice if no message properties are set.
GetPropertyNames() ([]string, JMSException)

// ClearProperties removes all message properties from this message.
ClearProperties() JMSException
}
Loading

0 comments on commit e84ce0e

Please sign in to comment.