Questo contenuto non è disponibile nella lingua selezionata.

6.6.4. Last Value Queue Command-line Example


The included programs drain and spout can be used for sending and receiving messages for testing purposes. The source code for the two utilities is included in the Python and C++ client library packages. The Python version can be run uncompiled using a Python interpreter.
Run the following qpid-config command to create a Last Value Queue:
qpid-config add queue my-queue --argument qpid.last_value_queue_key=type
Copy to Clipboard Toggle word wrap
The header key 'type' is used to match messages in the queue.
Now start one or more browsers using the drain command:
./drain -f -c 0 'my-queue; {mode: browse}'
Copy to Clipboard Toggle word wrap
These browsers will see all the messages as they arrive in the queue in real-time.
Now use spout to send messages to the queue, setting a header value for the key 'type':
./spout -P type=a my-queue a1 
./spout -P type=a my-queue a2 
./spout -P type=a my-queue a3 
./spout -P type=b my-queue b1 
./spout -P type=c my-queue c1 
./spout -P type=c my-queue c2 
./spout -P type=a my-queue a4
Copy to Clipboard Toggle word wrap
The browsers started before these messages were published will see all messages as they arrive.
Now start a new browser:
./drain -c 0 'my-queue; {mode: browse}'
Copy to Clipboard Toggle word wrap
This browser will see only the last messages for each of the unique 'type' values.
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2025 Red Hat