Message Process abc A def D ghi D jkl C #### SELECT DISTINCT(Process) FROM Queue; #### $SIG{USR1} = \&CatchSignal; ... sub CatchSignal { my $signal = shift; if ($signal eq "USR1") { $SIG_CHECK_DATABASE = 1; } } ... if ($SIG_CHECK_DATABASE) { # Process all messages from the database queue $SIG_CHECK_DATABASE = 0; }