public class QueueManagerServiceImpl extends Object implements QueueManagerService
Modifier and Type | Field and Description |
---|---|
static String |
DOMAIN_NAME_SEPARATOR
Tenant domain name separator
|
protected static String |
EVENT_TOPICS |
Constructor and Description |
---|
QueueManagerServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addQueueAndAssignPermission(String queueName,
QueueRolePermission[] queueRolePermissions)
Create a queue and assign permissions which could be be pub, consume, change permission and etc.
|
Message[] |
browseQueue(String nameOfQueue,
long nextMessageIdToRead,
int maxMsgCount)
Gets the messages of a queue
|
void |
createQueue(String queueName)
Creates a new queue
|
void |
deleteMessagesFromDeadLetterQueue(long[] messageIDs,
String destinationQueueName)
Delete messages from the Dead Letter Queue and delete their content.
|
void |
deleteQueue(String queueName)
This method is triggered when deleting a queue through management console.
|
void |
deleteTopicFromRegistry(String topicName,
String subscriptionId)
This method is triggered unsubscribe from a durable subscription to delete topic related
entries from registry
|
void |
dumpMessageStatus()
Dump message status to a default file.
|
List<Queue> |
getAllQueues()
Gets all the queues
|
String[] |
getBackendRoles()
Gets roles except for admin
|
Queue |
getDLCQueue(String tenantDomain)
Retrieve the dlc queue associated to a tenant
|
long |
getMessageCount(String destinationName,
String msgPattern)
Gets the message count for a queue
|
Message[] |
getMessageMetadataInDLC(String targetQueue,
long startMessageId,
int pageLimit)
Returns a paginated list of message metadata destined for the inputQueueName but currently living in the Dead Letter Channel.
|
Message[] |
getMessagesInDLCForQueue(String queueName,
long nextMessageIdToRead,
int maxMessageCount)
Gets the messages in the DLC for a specific queue.
|
Set<String> |
getNamesOfAllDurableQueues()
Retrieve names of all durable queues created
|
long |
getNumberOfMessagesInDLCForQueue(String queueName)
Gets the number of messages in DLC for a specific queue.
|
Queue |
getQueueByName(String queueName)
Retrieve a queue with the number of the messages remaining by passing the name
|
QueueRolePermission[] |
getQueueRolePermission(String queueName)
Gets role permissions assigned to a queue
|
long |
getTotalMessagesInQueue(String nameOfQueue)
Gets total message count in a queue
|
void |
purgeMessagesOfQueue(String queueName)
Request broker to clean all messages not awaiting acknowledgement from the given queue.
|
int |
rerouteMessagesFromDeadLetterChannelForQueue(String sourceQueue,
String targetQueue,
int internalBatchSize)
Restore messages destined for the input sourceQueue into a different targetQueue.
|
long |
rerouteSelectedMessagesFromDeadLetterChannel(long[] messageIDs,
String newDestinationQueueName,
String destinationQueueName)
Restore messages from the Dead Letter Queue to another queue in the same tenant.
|
long |
restoreSelectedMessagesFromDeadLetterChannel(long[] messageIDs,
String destinationQueueName)
Restore messages from the Dead Letter Queue to their original queues.
|
boolean |
sendMessage(String nameOfQueue,
String userName,
String accessKey,
String jmsType,
String jmsCorrelationID,
int numberOfMessages,
String message,
int deliveryMode,
int priority,
long expireTime)
Send a message to the queue
|
void |
updatePermission(String queueName,
QueueRolePermission[] queueRolePermissions)
Updates permission for a queue.
|
protected static final String EVENT_TOPICS
public static final String DOMAIN_NAME_SEPARATOR
public void createQueue(String queueName) throws QueueManagerException
createQueue
in interface QueueManagerService
queueName
- new queue nameQueueManagerException
- Thrown when an error occurs while creating a queuepublic Queue getQueueByName(String queueName) throws QueueManagerException
getQueueByName
in interface QueueManagerService
queueName
- the name of the queue to be retrievedQueue
the queueQueueManagerException
- Thrown when an error occurs while retrieving the queue by namepublic Set<String> getNamesOfAllDurableQueues() throws QueueManagerException
QueueManagerService
getNamesOfAllDurableQueues
in interface QueueManagerService
QueueManagerException
- on an issue getting informationpublic Queue getDLCQueue(String tenantDomain) throws QueueManagerException
getDLCQueue
in interface QueueManagerService
tenantDomain
- The name of the tenant domainQueue
the dlc queueQueueManagerException
- Thrown when an error occurs while retrieving the dlc queuepublic List<Queue> getAllQueues() throws QueueManagerException
getAllQueues
in interface QueueManagerService
Queue
queuesQueueManagerException
- Thrown when an error occurs while retriving all queuespublic void deleteQueue(String queueName) throws QueueManagerException
deleteQueue
in interface QueueManagerService
queueName
- name of the queueQueueManagerException
- Thrown when an error occurs while deleting a queuepublic void deleteTopicFromRegistry(String topicName, String subscriptionId) throws QueueManagerException
deleteTopicFromRegistry
in interface QueueManagerService
topicName
- Topic namesubscriptionId
- Subscription IDQueueManagerException
- Thrown when an error occurs while deleting topic from registrypublic long restoreSelectedMessagesFromDeadLetterChannel(long[] messageIDs, String destinationQueueName) throws QueueManagerException
restoreSelectedMessagesFromDeadLetterChannel
in interface QueueManagerService
messageIDs
- Browser Message Id / External Message Id listdestinationQueueName
- Dead Letter Queue name for the respective tenantQueueManagerException
- Thrown when an error occurs while Restore messages from the Dead Letter Queuepublic long rerouteSelectedMessagesFromDeadLetterChannel(long[] messageIDs, String newDestinationQueueName, String destinationQueueName) throws QueueManagerException
rerouteSelectedMessagesFromDeadLetterChannel
in interface QueueManagerService
messageIDs
- Browser Message Id / External Message Id listnewDestinationQueueName
- The new destination queue for the messages in the same tenantdestinationQueueName
- Dead Letter Queue name for the respective tenantQueueManagerException
- Thrown when an error occurs while restoring messages from the Dead Letter Queuepublic void deleteMessagesFromDeadLetterQueue(long[] messageIDs, String destinationQueueName) throws QueueManagerException
deleteMessagesFromDeadLetterQueue
in interface QueueManagerService
messageIDs
- Browser Message Id / External Message Id list to be deleteddestinationQueueName
- Dead Letter Queue name for the respective tenantQueueManagerException
- Thrown when an error occurs while deleting messages from DLC queuepublic void purgeMessagesOfQueue(String queueName) throws QueueManagerException
purgeMessagesOfQueue
in interface QueueManagerService
queueName
- the queue nameQueueManagerException
- Thrown when an error occurs while purging all messagespublic long getMessageCount(String destinationName, String msgPattern) throws QueueManagerException
getMessageCount
in interface QueueManagerService
destinationName
- the destination name. the name of the queue or topicmsgPattern
- The exchange type used to transfer messages with the given destinationName. e.g. "queue" or "topic"QueueManagerException
- Thrown when an error occurs while getting message countpublic void updatePermission(String queueName, QueueRolePermission[] queueRolePermissions) throws QueueManagerException
updatePermission
in interface QueueManagerService
queueName
- the queue namequeueRolePermissions
- the new permissions for the queueQueueManagerException
- Thrown when an error occurs while updating permissionpublic void addQueueAndAssignPermission(String queueName, QueueRolePermission[] queueRolePermissions) throws QueueManagerException
addQueueAndAssignPermission
in interface QueueManagerService
queueName
- the queue namequeueRolePermissions
- the new permissions for the queueQueueManagerException
- Thrown when an error occurs while creating a queue and assigning permissionspublic String[] getBackendRoles() throws QueueManagerException
getBackendRoles
in interface QueueManagerService
QueueManagerException
- Thrown when an error occurs while retrieving rolespublic QueueRolePermission[] getQueueRolePermission(String queueName) throws QueueManagerException
getQueueRolePermission
in interface QueueManagerService
queueName
- the queue nameQueueManagerException
- Thrown when an error occurs while retrieving role permissions assigned to a queuepublic Message[] browseQueue(String nameOfQueue, long nextMessageIdToRead, int maxMsgCount) throws QueueManagerException
browseQueue
in interface QueueManagerService
nameOfQueue
- name of the queuenextMessageIdToRead
- next start message id to get message listmaxMsgCount
- the maximum messages to returnQueueManagerException
- Thrown when an error occurs while retrieving the messages of a queuepublic long getTotalMessagesInQueue(String nameOfQueue) throws QueueManagerException
getTotalMessagesInQueue
in interface QueueManagerService
nameOfQueue
- the queue nameQueueManagerException
- Thrown when an error occurs while retrieving total message count in a queuepublic boolean sendMessage(String nameOfQueue, String userName, String accessKey, String jmsType, String jmsCorrelationID, int numberOfMessages, String message, int deliveryMode, int priority, long expireTime) throws QueueManagerException
sendMessage
in interface QueueManagerService
nameOfQueue
- name of the queueuserName
- the user name for the amqp urlaccessKey
- the access key for the amqp urljmsType
- the JMS type of the messagejmsCorrelationID
- the correlation ID of the JMS messagenumberOfMessages
- number of messages to sendmessage
- the message content/bodydeliveryMode
- the delivery modepriority
- priority of the messageexpireTime
- message expire timeQueueManagerException
- Thrown when an error occurs while sending a message to the queuepublic long getNumberOfMessagesInDLCForQueue(String queueName) throws QueueManagerException
getNumberOfMessagesInDLCForQueue
in interface QueueManagerService
queueName
- The name of the queue.QueueManagerException
- Thrown when an error occurs while retrieving the no of messages in DLCpublic Message[] getMessagesInDLCForQueue(String queueName, long nextMessageIdToRead, int maxMessageCount) throws QueueManagerException
getMessagesInDLCForQueue
in interface QueueManagerService
queueName
- name of the queuenextMessageIdToRead
- next start message id to get message listmaxMessageCount
- the maximum messages to returnQueueManagerException
- if an exception occurs when invoking the MBean Service.public void dumpMessageStatus() throws AndesException
dumpMessageStatus
in interface QueueManagerService
AndesException
- Thrown when an error occurs while dumping message statuspublic Message[] getMessageMetadataInDLC(String targetQueue, long startMessageId, int pageLimit) throws QueueManagerException
getMessageMetadataInDLC
in interface QueueManagerService
targetQueue
- Name of the destination queuestartMessageId
- Start point of the queue message id to start readingpageLimit
- Maximum messages required in a single responseMessage
QueueManagerException
- if an error occurs while invoking the MBean to fetch messages.public int rerouteMessagesFromDeadLetterChannelForQueue(String sourceQueue, String targetQueue, int internalBatchSize) throws QueueManagerException
rerouteMessagesFromDeadLetterChannelForQueue
in interface QueueManagerService
sourceQueue
- Name of the source queuetargetQueue
- Name of the target queue.internalBatchSize
- even with this method, the MB server will internally read messages in DLC in batches,
and simulate each batch as a new message list to the targetQueue. internalBatchSize
controls the number of messages processed in a single batch internally.QueueManagerException
- if an exception occurs while invoking the MBean service.Copyright © 2017 WSO2. All rights reserved.