-
Notifications
You must be signed in to change notification settings - Fork 19
/
JMSConsumer.go
57 lines (48 loc) · 2.55 KB
/
JMSConsumer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Derived from the Eclipse Project for JMS, available at;
// https://github.com/eclipse-ee4j/jms-api
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0, which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// SPDX-License-Identifier: EPL-2.0
// Package jms20subset provides interfaces for messaging applications in the style of the Java Message Service (JMS) API.
package jms20subset
// JMSConsumer provides the ability for an application to receive messages
// from a queue or a topic.
//
// Note that Golang doesn't provide Generics in the same way as Java so we have
// to create multiple separate functions to provide capability equivalent to the
// Java JMS receiveBody(Class<T>) method.
type JMSConsumer interface {
// ReceiveNoWait receives the next message if one is available, or nil if
// there is no message immediately available
ReceiveNoWait() (Message, JMSException)
// Receive(waitMillis) returns a message if one is available, or otherwise
// waits for up to the specified number of milliseconds for one to become
// available. A value of zero or less indicates to wait indefinitely.
Receive(waitMillis int32) (Message, JMSException)
// ReceiveStringBodyNoWait receives the next message for this JMSConsumer
// and returns its body as a string. If a message is not immediately
// available a nil is returned.
ReceiveStringBodyNoWait() (*string, JMSException)
// ReceiveStringBody returns the body of a message as a string if one is
// available. If a message is not immediately available the method will
// block for up to the specified number of milliseconds to wait for one
// to become available. A value of zero or less indicates to wait
// indefinitely.
ReceiveStringBody(waitMillis int32) (*string, JMSException)
// ReceiveBytesBodyNoWait receives the next message for this JMSConsumer
// and returns its body as a slice of bytes. If a message is not immediately
// available an uninitialized *[]byte is returned.
ReceiveBytesBodyNoWait() (*[]byte, JMSException)
// ReceiveBytesBody returns the body of a message as a slice of bytes if one is
// available. If a message is not immediately available the method will
// block for up to the specified number of milliseconds to wait for one
// to become available. A value of zero or less indicates to wait
// indefinitely.
ReceiveBytesBody(waitMillis int32) (*[]byte, JMSException)
// Closes the JMSConsumer in order to free up any resources that were
// allocated by the provider on behalf of this consumer.
Close()
}