> For the complete documentation index, see [llms.txt](https://docs.rekor.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rekor.ai/scout/application-integration/pulling-from-the-queue.md).

# Pulling from the Queue

Rekor maintains a local Beanstalkd queue. All JSON results are placed in this queue. Your application can grab and process the latest plate results from this queue.

Beanstalkd maintains client libraries in many popular programming languages. For a complete list, visit: <https://github.com/kr/beanstalkd/wiki/Client-Libraries>

To configure Rekor Scout® to make the results available via the local queue, set the following parameters in `/etc/openalpr/alprd.conf`:

```
upload_data = 0
websockets_enabled = 0
web_server_enabled = 1
use_beanstalkd = 1
```

In addition, you must add a valid on-premise license to `/etc/openalpr/license.conf`

Once updated, restart the Scout Agent service to allow the settings to take effect.

Below is a sample Python script that pulls results from the local Beanstalkd queue:

```python
#!/usr/bin/python

import beanstalkc
import json
from pprint import pprint

beanstalk = beanstalkc.Connection(host='localhost', port=11300)

TUBE_NAME='alprd'

# For diagnostics, print out a list of all the tubes available in Beanstalk.
print beanstalk.tubes()

# For diagnostics, print the number of items on the current alprd queue.
try:
    pprint(beanstalk.stats_tube(TUBE_NAME))
except beanstalkc.CommandFailed:
    print "Tube doesn't exist"

# Watch the "alprd" tube; this is where the plate data is.
beanstalk.watch(TUBE_NAME)

# Loop forever
while True:

    # Wait for a second to get a job. If there is a job, process it and delete it from the queue.
    # If not, return to sleep.
    job = beanstalk.reserve(timeout=1.0)

    if job is None:
        print "No plates available right now, waiting..."

    else:
        print "Found a plate!"
        plates_info = json.loads(job.body)

        # Print all the info about this plate to the console.
        pprint(plates_info)

        # Do something with this data (e.g., match a list, open a gate, etc.).
        if 'data_type' not in plates_info:
            print "This shouldn't be here... all OpenALPR data should have a data_type"
        elif plates_info['data_type'] == 'alpr_results':
            print "This is a plate result"
        elif plates_info['data_type'] == 'alpr_group':
            print "This is a group result"
        elif plates_info['data_type'] == 'heartbeat':
            print "This is a heartbeat"

        # Delete the job from the queue when it is processed.
        job.delete()
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rekor.ai/scout/application-integration/pulling-from-the-queue.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
