mqjms

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2024 License: EPL-2.0 Imports: 14 Imported by: 8

Documentation

Overview

Package mqjms provides the implementation of the JMS style Golang interfaces to communicate with IBM MQ.

Package mqjms provides the implementation of the JMS style Golang interfaces to communicate with IBM MQ.

Package mqjms provides the implementation of the JMS style Golang interfaces to communicate with IBM MQ.

Package mqjms provides the implementation of the JMS style Golang interfaces to communicate with IBM MQ.

Package mqjms provides the implementation of the JMS style Golang interfaces to communicate with IBM MQ.

Package mqjms provides the implementation of the JMS style Golang interfaces to communicate with IBM MQ.

Package mqjms provides the implementation of the JMS style Golang interfaces to communicate with IBM MQ.

Package mqjms provides the implementation of the JMS style Golang interfaces to communicate with IBM MQ.

Package mqjms provides the implementation of the JMS style Golang interfaces to communicate with IBM MQ.

Package mqjms provides the implementation of the JMS style Golang interfaces to communicate with IBM MQ.

Package mqjms provides the implementation of the JMS style Golang interfaces to communicate with IBM MQ.

Index

Constants

View Source
const ContextImpl_TRANSACTED_ASYNCPUT_ACTIVE int = -100

ContextImpl_TRANSACTED_ASYNCPUT_ACTIVE is an internal constant that indicates that a transacted asynchronous put has taken place.

View Source
const MessageImpl_PROPERTY_CONVERT_FAILED_CODE string = "1055"
View Source
const MessageImpl_PROPERTY_CONVERT_FAILED_REASON string = "MQJMS_E_BAD_TYPE"
View Source
const MessageImpl_PROPERTY_CONVERT_NOTSUPPORTED_CODE string = "1056	"
View Source
const MessageImpl_PROPERTY_CONVERT_NOTSUPPORTED_REASON string = "MQJMS_E_UNSUPPORTED_TYPE"
View Source
const TLSClientAuth_NONE string = "NONE"

TLSClientAuth_NONE is used to configure the TLSClientAuth property to indicate that a client certificate should not be sent.

View Source
const TLSClientAuth_REQUIRED string = "REQUIRED"

TLSClientAuth_REQUIRED is used to configure the TLSClientAuth property to indicate that a client certificate must be sent to the queue manager, as part of mutual TLS.

View Source
const TransportType_BINDINGS int = 1

TransportType_BINDINGS is used to configure the TransportType property of the ConnectionFactory, to use a local bindings connection to the queue manager

View Source
const TransportType_CLIENT int = 0

TransportType_CLIENT is used to configure the TransportType property of the ConnectionFactory, to use a TCP client connection to the queue manager. This is the default.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrowserImpl added in v1.7.0

type BrowserImpl struct {
	ConsumerImpl // Browser is a specialized form of consumer
	// contains filtered or unexported fields
}

BrowserImpl represents the JMS QueueBrowser object that allows applications to peek at messages on a queue without destructively consuming them.

func (*BrowserImpl) GetEnumeration added in v1.7.0

func (browser *BrowserImpl) GetEnumeration() (jms20subset.MessageIterator, jms20subset.JMSException)

GetEnumeration returns an iterator for browsing the current queue messages in the order they would be received.

In this implementation there is exactly one Enumeration per QueueBrowser. If an application wants to browse two independent copies of the messages it must create two QueueBrowsers.

func (*BrowserImpl) GetNext added in v1.7.0

func (browser *BrowserImpl) GetNext() (jms20subset.Message, jms20subset.JMSException)

GetNext returns the next Message that is available or else nil if no messages are available.

type BytesMessageImpl added in v1.3.0

type BytesMessageImpl struct {
	MessageImpl // embed the "parent" message object that defines the basic behaviour
	// contains filtered or unexported fields
}

BytesMessageImpl contains the IBM MQ specific attributes necessary to present a message that carries a slice of bytes

func (*BytesMessageImpl) GetBodyLength added in v1.3.0

func (msg *BytesMessageImpl) GetBodyLength() int

GetBodyLength returns the length of the bytes that are stored in this message

func (*BytesMessageImpl) ReadBytes added in v1.3.0

func (msg *BytesMessageImpl) ReadBytes() *[]byte

ReadBytes returns the string that is contained in this BytesMessage.

func (*BytesMessageImpl) WriteBytes added in v1.3.0

func (msg *BytesMessageImpl) WriteBytes(bytes []byte)

WriteBytes stores the supplied slice of bytes so that it can be transmitted as part of this BytesMessage.

type ConnectionFactoryImpl

type ConnectionFactoryImpl struct {
	QMName      string
	Hostname    string
	PortNumber  int
	ChannelName string
	UserName    string
	Password    string

	TransportType int // Default to TransportType_CLIENT (0)

	// Equivalent to SSLCipherSpec and SSLClientAuth in the MQI client, however
	// the names have been updated here to reflect that SSL protocols have all
	// been discredited.
	TLSCipherSpec string
	TLSClientAuth string // Default to TLSClientAuth_NONE

	KeyRepository    string
	CertificateLabel string

	// Allthough only available per MQ 9.1.2 it looks like a good idea to have this present in MQ-JMS
	ApplName string

	// Controls the size of the buffer used when receiving a message (default is 32kb if not set)
	ReceiveBufferSize int

	// SetCheckCount defines the number of messages that will be asynchronously put using
	// this Context between checks for errors. For example a value of 10 will cause an error
	// check to be triggered once for every 10 messages.
	//
	// See also Destination#SetPutAsyncAllowed(int)
	//
	// Default of 0 (zero) means that no checks are made for asynchronous put calls.
	SendCheckCount int
}

ConnectionFactoryImpl defines a struct that contains attributes for each of the key properties required to establish a connection to an IBM MQ queue manager.

The fields are defined as Public so that the struct can be initialised programmatically using whatever approach the application prefers.

func CreateConnectionFactoryFromDefaultJSONFiles

func CreateConnectionFactoryFromDefaultJSONFiles() (cf ConnectionFactoryImpl, err error)

CreateConnectionFactoryFromDefaultJSONFiles is a utility method that creates a JMS ConnectionFactory object that is populated with properties from values stored in two external files on the file system.

This method reads the following files;

  • $HOME/Downloads/connection_info.json for host/port/channel information
  • $HOME/Downloads/applicationApiKey.json for username/password information

If your queue manager is hosted on the IBM MQ on Cloud service then you can download these two files directly from the IBM Cloud service console. Alternative you can use the example files provided in the /config-samples directory of this repository and populate them with the details of your own queue manager.

func CreateConnectionFactoryFromJSON

func CreateConnectionFactoryFromJSON(connectionInfoLocn string, apiKeyLocn string) (cf ConnectionFactoryImpl, err error)

CreateConnectionFactoryFromJSON is a utility method that creates a JMS ConnectionFactory object that is populated with properties from values stored in two external files on the file system.

The calling application provides the fully qualified path to the location of the file as the two parameters. If empty string is provided then the default location and name is assumed as follows;

  • $HOME/Downloads/connection_info.json for host/port/channel information
  • $HOME/Downloads/applicationApiKey.json for username/password information

If your queue manager is hosted on the IBM MQ on Cloud service then you can download these two files directly from the IBM Cloud service console. Alternative you can use the example files provided in the /config-samples directory of this repository and populate them with the details of your own queue manager.

func (ConnectionFactoryImpl) CreateContext

CreateContext implements the JMS method to create a connection to an IBM MQ queue manager.

func (ConnectionFactoryImpl) CreateContextWithSessionMode added in v1.3.0

func (cf ConnectionFactoryImpl) CreateContextWithSessionMode(sessionMode int, mqos ...jms20subset.MQOptions) (jms20subset.JMSContext, jms20subset.JMSException)

CreateContextWithSessionMode implements the JMS method to create a connection to an IBM MQ queue manager using the specified session mode.

type ConsumerImpl

type ConsumerImpl struct {
	// contains filtered or unexported fields
}

ConsumerImpl defines a struct that contains the necessary objects for receiving messages from a queue on an IBM MQ queue manager.

func (ConsumerImpl) Close

func (consumer ConsumerImpl) Close()

Close closes the JMSConsumer, releasing any resources that were allocated on behalf of that consumer.

func (ConsumerImpl) Receive

func (consumer ConsumerImpl) Receive(waitMillis int32) (jms20subset.Message, jms20subset.JMSException)

Receive with 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.

func (ConsumerImpl) ReceiveBytesBody added in v1.3.0

func (consumer ConsumerImpl) ReceiveBytesBody(waitMillis int32) (*[]byte, jms20subset.JMSException)

ReceiveBytesBody implements the IBM MQ logic necessary to receive a message from a Destination and return its body as a slice of bytes.

If no message is available the method blocks up to the specified number of milliseconds for one to become available.

func (ConsumerImpl) ReceiveBytesBodyNoWait added in v1.3.0

func (consumer ConsumerImpl) ReceiveBytesBodyNoWait() (*[]byte, jms20subset.JMSException)

ReceiveBytesBodyNoWait implements the IBM MQ logic necessary to receive a message from a Destination and return its body as a slice of bytes.

If no message is immediately available to be returned then a nil is returned.

func (ConsumerImpl) ReceiveNoWait

func (consumer ConsumerImpl) ReceiveNoWait() (jms20subset.Message, jms20subset.JMSException)

ReceiveNoWait implements the IBM MQ logic necessary to receive a message from a Destination, or immediately return a nil Message if there is no available message to be received.

func (ConsumerImpl) ReceiveStringBody

func (consumer ConsumerImpl) ReceiveStringBody(waitMillis int32) (*string, jms20subset.JMSException)

ReceiveStringBody implements the IBM MQ logic necessary to receive a message from a Destination and return its body as a string.

If no message is available the method blocks up to the specified number of milliseconds for one to become available.

func (ConsumerImpl) ReceiveStringBodyNoWait

func (consumer ConsumerImpl) ReceiveStringBodyNoWait() (*string, jms20subset.JMSException)

ReceiveStringBodyNoWait implements the IBM MQ logic necessary to receive a message from a Destination and return its body as a string.

If no message is immediately available to be returned then a nil is returned.

type ContextImpl

type ContextImpl struct {
	// contains filtered or unexported fields
}

ContextImpl encapsulates the objects necessary to maintain an active connection to an IBM MQ queue manager.

func (ContextImpl) Close

func (ctx ContextImpl) Close()

Close this connection to the MQ queue manager, and release any resources that were allocated to support this connection.

func (ContextImpl) Commit added in v1.3.0

func (ctx ContextImpl) Commit() jms20subset.JMSException

Commit confirms all messages that were sent under this transaction.

func (ContextImpl) CreateBrowser added in v1.7.0

CreateBrowser creates a consumer for the specified Destination so that an application can look at messages without removing them.

func (ContextImpl) CreateBytesMessage added in v1.3.0

func (ctx ContextImpl) CreateBytesMessage() jms20subset.BytesMessage

CreateBytesMessage is a JMS standard mechanism for creating a BytesMessage.

func (ContextImpl) CreateBytesMessageWithBytes added in v1.3.0

func (ctx ContextImpl) CreateBytesMessageWithBytes(bytes []byte) jms20subset.BytesMessage

CreateBytesMessageWithBytes is a JMS standard mechanism for creating a BytesMessage.

func (ContextImpl) CreateConsumer

CreateConsumer creates a consumer object that allows an application to receive messages from the specified Destination.

func (ContextImpl) CreateConsumerWithSelector

func (ctx ContextImpl) CreateConsumerWithSelector(dest jms20subset.Destination, selector string) (jms20subset.JMSConsumer, jms20subset.JMSException)

CreateConsumerWithSelector creates a consumer object that allows an application to receive messages that match the specified selector from the given Destination.

func (ContextImpl) CreateProducer

func (ctx ContextImpl) CreateProducer() jms20subset.JMSProducer

CreateProducer implements the logic necessary to create a JMSProducer object that allows messages to be sent to destinations in IBM MQ.

func (ContextImpl) CreateQueue

func (ctx ContextImpl) CreateQueue(queueName string) jms20subset.Queue

CreateQueue implements the logic necessary to create a provider-specific object representing an IBM MQ queue.

func (ContextImpl) CreateTextMessage

func (ctx ContextImpl) CreateTextMessage() jms20subset.TextMessage

CreateTextMessage is a JMS standard mechanism for creating a TextMessage.

func (ContextImpl) CreateTextMessageWithString

func (ctx ContextImpl) CreateTextMessageWithString(txt string) jms20subset.TextMessage

CreateTextMessageWithString is a JMS standard mechanism for creating a TextMessage and initialise it with the chosen text string.

func (ContextImpl) Rollback added in v1.3.0

func (ctx ContextImpl) Rollback() jms20subset.JMSException

Rollback releases all messages that were sent under this transaction.

type MessageImpl added in v1.3.0

type MessageImpl struct {
	// contains filtered or unexported fields
}

MessageImpl contains the IBM MQ specific attributes that are common to all types of message.

func (*MessageImpl) ClearProperties added in v1.5.0

func (msg *MessageImpl) ClearProperties() jms20subset.JMSException

ClearProperties removes all message properties from this message.

func (*MessageImpl) GetBooleanProperty added in v1.5.0

func (msg *MessageImpl) GetBooleanProperty(name string) (bool, jms20subset.JMSException)

GetBooleanProperty returns the bool value of a named message property. Returns false if the named property is not set.

func (*MessageImpl) GetDoubleProperty added in v1.5.0

func (msg *MessageImpl) GetDoubleProperty(name string) (float64, jms20subset.JMSException)

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

func (*MessageImpl) GetIntProperty added in v1.5.0

func (msg *MessageImpl) GetIntProperty(name string) (int, jms20subset.JMSException)

GetIntProperty returns the int value of a named message property. Returns 0 if the named property is not set.

func (*MessageImpl) GetJMSCorrelationID added in v1.3.0

func (msg *MessageImpl) GetJMSCorrelationID() string

GetJMSCorrelationID retrieves the correl ID from the native MQ message descriptor field.

func (*MessageImpl) GetJMSDeliveryMode added in v1.3.0

func (msg *MessageImpl) GetJMSDeliveryMode() int

GetJMSDeliveryMode extracts the persistence setting from this message and returns it in the JMS delivery mode format.

func (*MessageImpl) GetJMSExpiration added in v1.8.0

func (msg *MessageImpl) GetJMSExpiration() int64

GetJMSExpiration returns the timestamp at which the message is due to expire.

func (*MessageImpl) GetJMSMessageID added in v1.3.0

func (msg *MessageImpl) GetJMSMessageID() string

GetJMSMessageID extracts the message ID from the native MQ message descriptor.

func (*MessageImpl) GetJMSPriority added in v1.8.0

func (msg *MessageImpl) GetJMSPriority() int

GetJMSPriority extracts the message priority from the native MQ message descriptor.

func (*MessageImpl) GetJMSReplyTo added in v1.3.0

func (msg *MessageImpl) GetJMSReplyTo() jms20subset.Destination

GetJMSReplyTo extracts the native reply information from the MQ message and populates it into a Destination object.

func (*MessageImpl) GetJMSTimestamp added in v1.3.0

func (msg *MessageImpl) GetJMSTimestamp() int64

GetJMSTimestamp retrieves the timestamp at which the message was sent from the native MQ message descriptor fields.

func (*MessageImpl) GetPropertyNames added in v1.5.0

func (msg *MessageImpl) GetPropertyNames() ([]string, jms20subset.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.

func (*MessageImpl) GetStringProperty added in v1.5.0

func (msg *MessageImpl) GetStringProperty(name string) (*string, jms20subset.JMSException)

GetStringProperty returns the string value of a named message property. Returns nil if the named property is not set.

func (*MessageImpl) PropertyExists added in v1.5.0

func (msg *MessageImpl) PropertyExists(name string) (bool, jms20subset.JMSException)

PropertyExists returns true if the named message property exists on this message.

func (*MessageImpl) SetBooleanProperty added in v1.5.0

func (msg *MessageImpl) SetBooleanProperty(name string, value bool) jms20subset.JMSException

SetBooleanProperty enables an application to set a bool-type message property.

func (*MessageImpl) SetDoubleProperty added in v1.5.0

func (msg *MessageImpl) SetDoubleProperty(name string, value float64) jms20subset.JMSException

SetDoubleProperty enables an application to set a double-type (float64) message property.

func (*MessageImpl) SetIntProperty added in v1.5.0

func (msg *MessageImpl) SetIntProperty(name string, value int) jms20subset.JMSException

SetIntProperty enables an application to set a int-type message property.

func (*MessageImpl) SetJMSCorrelationID added in v1.3.0

func (msg *MessageImpl) SetJMSCorrelationID(correlID string) jms20subset.JMSException

SetJMSCorrelationID applies the specified correlation ID string to the native MQ message field used for correlation purposes.

func (*MessageImpl) SetJMSReplyTo added in v1.3.0

func (msg *MessageImpl) SetJMSReplyTo(dest jms20subset.Destination) jms20subset.JMSException

SetJMSReplyTo uses the specified Destination object to configure the reply attributes of the native MQ message fields.

func (*MessageImpl) SetStringProperty added in v1.5.0

func (msg *MessageImpl) SetStringProperty(name string, value *string) jms20subset.JMSException

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.

type ProducerImpl

type ProducerImpl struct {
	// contains filtered or unexported fields
}

ProducerImpl defines a struct that contains the necessary objects for sending messages to a queue on an IBM MQ queue manager.

func (*ProducerImpl) GetDeliveryMode

func (producer *ProducerImpl) GetDeliveryMode() int

GetDeliveryMode returns the current delivery mode that is set on this Producer.

func (*ProducerImpl) GetPriority added in v1.8.0

func (producer *ProducerImpl) GetPriority() int

GetPriority returns the priority for all messages sent by this producer.

func (*ProducerImpl) GetTimeToLive

func (producer *ProducerImpl) GetTimeToLive() int

GetTimeToLive returns the current time to live that is set on this Producer.

func (ProducerImpl) Send

Send a message to the specified IBM MQ queue, using the message options that are defined on this JMSProducer.

func (ProducerImpl) SendBytes added in v1.3.0

func (producer ProducerImpl) SendBytes(dest jms20subset.Destination, body []byte) jms20subset.JMSException

SendBytes sends a BytesMessage with the specified body to the specified Destination using any message options that are defined on this JMSProducer.

func (ProducerImpl) SendString

func (producer ProducerImpl) SendString(dest jms20subset.Destination, bodyStr string) jms20subset.JMSException

SendString sends a TextMessage with the specified body to the specified Destination using any message options that are defined on this JMSProducer.

func (*ProducerImpl) SetDeliveryMode

func (producer *ProducerImpl) SetDeliveryMode(mode int) jms20subset.JMSProducer

SetDeliveryMode contains the MQ logic necessary to store the specified delivery mode parameter inside the Producer object so that it can be applied when sending messages using this Producer.

func (*ProducerImpl) SetPriority added in v1.8.0

func (producer *ProducerImpl) SetPriority(priority int) jms20subset.JMSProducer

SetPriority contains the MQ logic necessary to store the specified priority parameter inside the Producer object so that it can be applied when sending messages using this Producer.

func (*ProducerImpl) SetTimeToLive

func (producer *ProducerImpl) SetTimeToLive(timeToLive int) jms20subset.JMSProducer

SetTimeToLive contains the MQ logic necessary to store the specified time to live parameter inside the Producer object so that it can be applied when sending messages using this Producer.

type QueueImpl

type QueueImpl struct {
	// contains filtered or unexported fields
}

QueueImpl encapsulates the provider-specific attributes necessary to communicate with an IBM MQ queue.

func (QueueImpl) GetDestinationName

func (queue QueueImpl) GetDestinationName() string

GetDestinationName returns the name of the destination represented by this object.

func (QueueImpl) GetPutAsyncAllowed added in v1.4.0

func (queue QueueImpl) GetPutAsyncAllowed() int

GetPutAsyncAllowed returns the current setting for async put.

func (QueueImpl) GetQueueName

func (queue QueueImpl) GetQueueName() string

GetQueueName returns the provider-specific name of the queue that is represented by this object.

func (QueueImpl) SetPutAsyncAllowed added in v1.4.0

func (queue QueueImpl) SetPutAsyncAllowed(paa int) jms20subset.Queue

SetPutAsyncAllowed allows the async allowed setting to be updated.

type TextMessageImpl

type TextMessageImpl struct {
	MessageImpl // embed the "parent" message object that defines the basic behaviour
	// contains filtered or unexported fields
}

TextMessageImpl contains the IBM MQ specific attributes necessary to present a message that carries a string.

func (*TextMessageImpl) GetText

func (msg *TextMessageImpl) GetText() *string

GetText returns the string that is contained in this TextMessage.

func (*TextMessageImpl) SetText

func (msg *TextMessageImpl) SetText(newBody string)

SetText stores the supplied string so that it can be transmitted as part of this TextMessage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL