jeudi 8 avril 2010

Cet outil étend les fonctions WLST sur la migration de messages JMS d’une file à l’autre. Cette fonctionnalité est présente via la console Weblogic mais n’existe pas en natif dans les API WLST.

·     Scripte d’exportation d’une file JMS vers un fichier

#IMPORT/EXPORT FROM FILE - START

# must be on a domain runtime to proceed
domainRuntime()

print "--- ### export all message from SRC to file/dir \n"

print "  - go to SRC MBean [%s] \n" % mbean_src
cdMbeanQueueDomainRuntime(distributed_src, instancename_src, jmsservername_src, modulename, queue_src )

print "  - lsMessages from SRC ...\n"
lsMessages()

print "  - exportQueueMessagesToFile ...\n"
exportQueueMessagesToFile( outputfile )

print "  - exportQueueMessagesToDir ...\n"
exportQueueMessagesToDir( outputdir )

·         Scripte d’importation d’un fichier vers une file JMS.

print "--- ### import to DST from file/dir\n"

print "  - go to DST MBean [%s] \n" % mbean_dst

cdMbeanQueueDomainRuntime(distributed_dst, instancename_dst, jmsservername_dst, modulename, queue_dst )

print "  - importQueueMessagesFromFile ...\n"
importQueueMessagesFromFile( outputfile )

print "  - importQueueMessagesFromDir ...\n"
importQueueMessagesFromDir( outputdir )

print "  - RESULT ...\n"
print "  - lsMessages ...\n"

lsMessages()

·         Même fonctionnalité mais sur un ID de message.

ID=getFirtsFromListID()
print "--- ### get one message from the DST liste [ID=%s] ...\n" % ID

print "  - export [ID=%s]...\n" % ID
exportQueueMessageToFileById( ID, outputfile + ".uniq" )

print "  - deleteMessages ...\n"
deleteMessages()

print "  - lsMessages ...\n"
lsMessages()

print "  - importQueueMessagesFromFile ...\n"
importQueueMessagesFromFile( outputfile + ".uniq" )

print "  - lsMessages(one message [ID=%s]) ...\n" % ID
lsMessages()
ID=getFirtsFromListID()

print "  - deleteMessagesById(%s) ...\n" % ID
deleteMessagesById( ID )

·         Suspension et activation d’une file JMS pour ne pas prendre de message supplémentaire lors des imports/exports

print "--- ### pose/resume online queue ...\n"

print "  - poseAllOnlineQueue ...\n"
poseAllOnlineQueue()
print "  - resumeAllOnlineQueue ...\n"
resumeAllOnlineQueue()


print "--- ### pose/resume offline queue ...\n"

cdMbeanQueueEdit(distributed_dst, instancename_dst, jmsservername_dst, modulename, queue_dst )
print "  - pauseAllOfflineQueue ...\n"
pauseAllOfflineQueue()
print "  - resumeAllOfflineQueue ...\n"
resumeAllOfflineQueue()

·         Changer les messages de file JMS sans passer par un fichier intermédiaire.

print "  - move the messages from the SRC to DST"
cdMbeanQueueDomainRuntime(distributed_dst, instancename_dst, jmsservername_dst, modulename, queue_dst )
target=cmo.getDestinationInfo()
cdMbeanQueueDomainRuntime(distributed_src, instancename_src, jmsservername_src, modulename, queue_src )
count=cmo.moveMessages('',target)
print "[%s]" % count

·         Vous pouvez filtrer sur un ensemble de critère vous pouvez utiliser la méthode suivante

exportQueueMessagesToFileFiltered( filter, outputFileName ):

avec comme filtre possible :


QUERY : message selection or message filter

The selector is a regular boolean expression consists of a string with syntax similar to where clause of an SQL select statement. Selector can include various attributes associated with the messages headers and properties. WebLogic JMS allows the users to create selector expression based on JMS message header fields and or property fields. In addition to the standard JMS message header fields, you can also use the WebLogic specific system properties such as JMS_BEA_UnitOfOrder, JMS_BEA_Size and JMS_BEA_State.

Contents of the message body cannot be used as part of the filter xpression except for XMLMessage type. For XML message types, WebLogic provides a special syntax called “JMS_BEA_SELECT” based on XPATH expression in addition to the standard SQL select syntax. The XML selector can be used to select messages based on the content of the XML message body.

QUERY :

operator : <, >, =, LIKE (with %)

METADATA
Property Name
Description
Values
JMS_BEA_UnitOfOrder
The Unit Of Order Identifier
A valid client or system generated string representation of a UOO ID
JMS_BEA_SizeThe
The size of the message in bytes
A long value
JMS_BEA_State
The current state of the message
String literal
JMS_BEA_SequenceNumber
The sequence number assigned to messages by the system upon arrival on the destination
A long value.
JMS_BEA_DeliveryTime
Birth time of the message
A long value
JMS_BEA_RedeliveryLimit
The number of the redelivery attempts to be made before moving the message onto error destination
A long value
JMSXDeliveryCount
The number of times the message
A long value
                 
HEADER
JMSMessageID                                        
JMSDeliveryMode                         
JMSExpiration
JMSPriority
JMSRedelivered
JMSTimestamp

JMS_BEA_State
State
Description
Bitmask
String literal to be used in message selector
Visible
The message is visible on the destination and may be consumed
1
visible
Send
The message is pending because it is associated with an in progress send operation
2
send
Received
The message is pending because it has been received by a consumer but not yet acknowledged
4
receive
Transaction
The message is associated with a transactional “send” or “receive” operation that is in progress.
8
‘send transaction’ or ‘receive transaction’
Ordered
The message belongs to a Unit of Order.
16
ordered
Delayed
The message is pending because it has a scheduled delivery time or is otherwise delayed.
32
delayed
Expired
The message has expired and is no longer available for consumption.
64
expired
Redelivery-count-exceeded
The message has exceeded the redelivery count set for the destination and is no longer available for consumption
128
redelivery-count-exceeded
Paused
The message is pending because of a destination pause operation
256
 paused
Sequenced
The message that is part of a SAF sequence
512
sequenced
Unit of work component
The message is part of an Unit of work (UOW)
1024
unit-of-work-component
Deleted
The message marked for deletion
1073741824
deleted


Sample

Get all the messages that are in the queue with priority great than 5
“JMSPriority > 5”

Get all the messages that belong to the unit-of-order “BLUE”
“JMS_BEA_UnitOfOrder LIKE ‘BLUE’”

Get all the messages that are bigger than 1k size
“JMS_BEA_Size > 1024”

Get all the messages that are pending as part of a receive transaction
“JMS_BEA_State LIKE ‘receive transaction’”

Vous pouvez récupérer cet outil sous cette URL                         

4 commentaires:

Roger a dit…

Just what I was looking for!
We need some easily configurable command line tools to basically do what is possible using the admin console. I started to look into this a few days ago and found a few WLST samples on the Oracle forums. I was surprised to find out that the export function wasn't directly supported in WLST. We really want to use the same XML format as the admin console, does your tool do that?

What is the licensing for your JMS Extend? Is the source code available? I very much doubt that I would be allowed to use it in our environment unless it's expensive and comes from a big vendor or I can check the source an compile it my self!

/Roger P

Jean FRANCOIS a dit…

it is the same functionality we can found in the admin console but in WLST. You can download it freely at the end of this article ("Vous pouvez récupérer cet outil sous cette URL")

Bart Schelstraete a dit…

I receive this error:

--
java.lang.VerifyError: class cnam.outil.mbean.jms.ExportMessages$1 overrides final method printText.([CIIZZ)V
--

tenax_technologies a dit…

Java Platform, Enterprise Edition (Java EE) java software company is the industry-standard platform for building enterprise-class applications coded in the Java programming language. java software outsourcing Based on the solid foundation of Java Platform, Standard Edition (Java SE), Java EE adds libraries and system services that support the scalability, accessibility, security, java developers integrity, and other requirements of enterprise-class applications. http://www.tenaxtechnologies.com

AUTEUR

Ma photo
Carrières Sur Sein, Yvelines, France
Consultant Oracle (Ancien consultant BEA depuis 2001), je m’occupe des expertises sur les produits Oracle : SOCLE (Weblogic, Coherence, JRockit) SOA (Service Bus, SOA Suite, BPM)
MON CV

LABEL 3D

Blogumulus by Roy Tanck and Amanda Fazani

LABEL CLOUD

MAP

Locations of visitors to this page

AUTRES BLOG

LIVRES

MEMBRES