Message selection

Message selection can be based on message age or message content.


Use message age

We can choose to process only messages older than a certain time interval using the -T flag.

Time interval can be specified in Days, Hours and Minutes. The general format being [days:]hours:]minutes.

The parameter can take one or two times, -T [OlderThanTime][,YoungerThanTime].

For example:

  • Display messages older than five minutes
    dmpmqmsg -m QM1 -i Q1 -fstdout -T5
    
  • Display messages younger than five minutes
    dmpmqmsg -m QM1 -i Q1 -fstdout -T,5
    
  • Display messages older than one day but younger than two days.
    dmpmqmsg -m QM1 -i Q1 -fstdout -T1440,2880
    
  • The following command copies messages older than one hour from Q1 to Q2.
    dmpmqmsg -m QM1 -i Q1 -o Q2 -T1:0
    
  • The following command moves messages older than one week from Q1 to Q2
    dmpmqmsg -m QM1 -I Q1 -o Q2 -T7:0:0
    


Use message content

We can specify a maximum of three of each search string. If multiple strings are used, they are treated as follows:

    Positive search strings
    When multiple positive strings are used, then all the strings must be present for the search to match. For example, the command
    dmpmqmsg -iMATCH -s LIVERPOOL -s CHELSEA
    
    only returns messages that contain both strings.

    Negative search strings
    When multiple negative strings are used, then none of the strings must be present for the search to match. For example, the command
    dmpmqmsg -IMATCH -S HOME -S DRAW
    
    only returns messages that contain neither string.

Parent topic: dmpmqmsg (queue load and unload)