Copy Messages [copy]

Syntax:

    copy <source> -queue|-topic <target>
         [(-selector <selector>)|(-index <start> <stop>)]
         [-maxlimit <nmsgs>]

Copy messages from queue <source> to queue/topic <target>. A subset can be defined with -selector <selector> or by specifying a range with -index <start> <stop>. The source is always a queue and must reside on the local router (the one of the last "sr" command).

The -maxlimit parameter can be specified to limit this operation to this maximum number of messages to copy. Since SwiftMQ 9.7.1.

The following example copies all messages from queue testqueue to queue testqueue on the same router:

    router1/sys$queuemanager/usage> copy testqueue -queue testqueue1

    1000 messages processed.

    router1/sys$queuemanager/usage>

The next example copies all messages from queue testqueue1 to queue testqueue@router2 on a different router:

    router1/sys$queuemanager/usage> copy testqueue1 -queue testqueue@router2

    1000 messages processed.

    router1/sys$queuemanager/usage>

The next example copies messages from router2 queue testqueue to queue testqueue@router1, but with a message selector.

    router2/sys$queuemanager/usage> copy testqueue -queue testqueue@router1 -selector nMsg > 40 and nMsg < 70

    29 messages processed.

    router2/sys$queuemanager/usage>

The next example copies messages from router2 queue testqueue to queue testqueue@router1, but with a range (the first 100 messages).

    router2/sys$queuemanager/usage> copy testqueue -queue testqueue@router1 -index 0 99

    100 messages processed.

    router2/sys$queuemanager/usage>

The next example copies messages from queue testqueue to topic testtopic (can also be used with selector or a range):

    router1/sys$queuemanager/usage> copy testqueue -topic testtopic

    1000 messages processed.

    router1/sys$queuemanager/usage>

The last example copies messages from a durable subscriber queue test$test to queue testqueue1, but with a range. The names of durable subscriber queues are composed of <clientid>$<durablename>. For client id "test" and durable name "test" the queue name is "test$test".

    router1/sys$queuemanager/usage> copy test$test -queue testqueue1 -index 200 499

    300 messages processed.

    router1/sys$queuemanager/usage>