Skip to content

Commit 46dbd19

Browse files
committed
Documentation for Properties functions - #39
1 parent 86ba88c commit 46dbd19

File tree

4 files changed

+29
-23
lines changed

4 files changed

+29
-23
lines changed

jms20subset/Message.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,24 @@ type Message interface {
4848
// jms20subset.DeliveryMode_PERSISTENT and jms20subset.DeliveryMode_NON_PERSISTENT
4949
GetJMSDeliveryMode() int
5050

51-
// TODO documentation
51+
// SetStringProperty enables an application to set a string-type message property.
52+
//
53+
// value is *string which allows a nil value to be specified, to unset an individual
54+
// property.
5255
SetStringProperty(name string, value *string) JMSException
5356

54-
// TODO documentation
55-
// Returns string property, or nil if the property is not set.
57+
// GetStringProperty returns the string value of a named message property.
58+
// Returns nil if the named property is not set.
5659
GetStringProperty(name string) *string
5760

58-
// TODO documentation
61+
// PropertyExists returns true if the named message property exists on this message.
5962
PropertyExists(name string) (bool, JMSException)
6063

61-
// TODO documentation
64+
// GetPropertyNames returns a slice of strings containing the name of every message
65+
// property on this message.
66+
// Returns a zero length slice if no message properties are defined.
6267
GetPropertyNames() ([]string, JMSException)
6368

64-
// TODO documentation
69+
// ClearProperties removes all message properties from this message.
6570
ClearProperties() JMSException
6671
}

messageproperties_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ import (
2727
* JMS: SetStringProperty, GetStringProperty,
2828
* https://github.com/eclipse-ee4j/messaging/blob/master/api/src/main/java/jakarta/jms/Message.java#L1119
2929
*
30-
* JMS: PropertyExists, ClearProperties, GetPropertyNames
31-
* boolean propertyExists(String name) throws JMSException;
32-
* void clearProperties() throws JMSException;
33-
* Enumeration getPropertyNames() throws JMSException;
3430
*/
3531

3632
/*

mqjms/MessageImpl.go

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ func (msg *MessageImpl) GetApplName() string {
274274
return applName
275275
}
276276

277-
// TODO documentation
277+
// SetStringProperty enables an application to set a string-type message property.
278+
//
279+
// value is *string which allows a nil value to be specified, to unset an individual
280+
// property.
278281
func (msg *MessageImpl) SetStringProperty(name string, value *string) jms20subset.JMSException {
279282
var retErr jms20subset.JMSException
280283

@@ -306,7 +309,8 @@ func (msg *MessageImpl) SetStringProperty(name string, value *string) jms20subse
306309
return retErr
307310
}
308311

309-
// TODO documentation
312+
// GetStringProperty returns the string value of a named message property.
313+
// Returns nil if the named property is not set.
310314
func (msg *MessageImpl) GetStringProperty(name string) *string {
311315

312316
var valueStr string
@@ -337,26 +341,28 @@ func (msg *MessageImpl) GetStringProperty(name string) *string {
337341
return &valueStr
338342
}
339343

340-
// TODO documentation
344+
// PropertyExists returns true if the named message property exists on this message.
341345
func (msg *MessageImpl) PropertyExists(name string) (bool, jms20subset.JMSException) {
342346

343-
found, _, retErr := msg.getPropertyInternal(name)
347+
found, _, retErr := msg.getPropertiesInternal(name)
344348
return found, retErr
345349

346350
}
347351

348-
// TODO documentation
352+
// GetPropertyNames returns a slice of strings containing the name of every message
353+
// property on this message.
354+
// Returns a zero length slice if no message properties are defined.
349355
func (msg *MessageImpl) GetPropertyNames() ([]string, jms20subset.JMSException) {
350356

351-
_, propNames, retErr := msg.getPropertyInternal("")
357+
_, propNames, retErr := msg.getPropertiesInternal("")
352358
return propNames, retErr
353359
}
354360

355-
// TODO documentation
356-
// Two modes of operation;
357-
// - supply non-empty name parameter to check whether that property exists
358-
// - supply empty name parameter to get a []string of all property names
359-
func (msg *MessageImpl) getPropertyInternal(name string) (bool, []string, jms20subset.JMSException) {
361+
// getPropertiesInternal is an internal helper function that provides a largely
362+
// identical implication for two application-facing functions;
363+
// - PropertyExists supplies a non-empty name parameter to check whether that property exists
364+
// - GetPropertyNames supplies an empty name parameter to get a []string of all property names
365+
func (msg *MessageImpl) getPropertiesInternal(name string) (bool, []string, jms20subset.JMSException) {
360366

361367
impo := ibmmq.NewMQIMPO()
362368
pd := ibmmq.NewMQPD()
@@ -398,7 +404,7 @@ func (msg *MessageImpl) getPropertyInternal(name string) (bool, []string, jms20s
398404
return false, propNames, nil
399405
}
400406

401-
// TODO documentation
407+
// ClearProperties removes all message properties from this message.
402408
func (msg *MessageImpl) ClearProperties() jms20subset.JMSException {
403409

404410
// Get the list of all property names, as we have to delete

next-features.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Not currently implemented:
88
- MessageListener
99
- SendToQmgr, ReplyToQmgr
1010
- Topics (pub/sub)
11-
- Message Properties etc
1211
- Temporary destinations
1312
- Priority
1413
- Configurable option to auto-set the receive buffer length if the default 32kb is exceeded (less efficient that setting up front)

0 commit comments

Comments
 (0)