---
title: "Messaging Image Processor Worker | wasmCloud"
description: "Rust Wasm component example: async image processing worker that listens for jobs via messaging and stores results in blobstore."
canonical: "https://wasmcloud.com/docs/v1/examples/rust/component/messaging-image-processor-worker/"
---

This is documentation for wasmCloud **v1**, which is no longer actively maintained.

For up-to-date documentation, see the **[latest version](https://wasmcloud.com/docs/)** (v2).

Version: v1

# Messaging Image Processor Worker

This WebAssembly component listens for jobs (in this case, related to image processing) and performs the requested operations on assets stored in object storage (denoted by the individual job data).

As this component is primarily asynchronous in nature, job senders publish messages to the relevant messaging queue (this depends on *which* `wasmcloud:messaging` interface provider (ex. [`messaging-nats`](https://github.com/wasmCloud/wasmCloud/tree/main/crates/provider-messaging-nats), [`messaging-kafka`](https://github.com/wasmCloud/wasmCloud/tree/main/crates/provider-messaging-kafka)) is used.

Message that trigger job execution are remarkably simple:

json

```json
{ "job_id": "99c18a1c-6a84-11ef-a8ae-3cf011fe32f1" }
```

This is possible because this component relies on an interlinked component -- the [http-task-manager](https://github.com/wasmCloud/wasmCloud/tree/main/examples/rust/components/http-task-manager) for managing jobs, status, and relevant metadata.

## Architecture

This WebAssembly component requires a few other pieces to function:

- The [wasmCloud HTTP task manager component](https://github.com/wasmCloud/wasmCloud/tree/main/examples/rust/components/http-task-manager) for managing task status
- A `wasmcloud:blobstore` provider (ex. [`blobstore-fs`](https://github.com/wasmCloud/wasmCloud/tree/main/crates/provider-blobstore-fs), [`blobstore-s3`](https://github.com/wasmCloud/wasmCloud/tree/main/crates/provider-blobstore-s3), \[`blobstore-azure`\]\[blobstore-azure\], or a custom one)
- A `wasmcloud:messaging` provider (ex. [`messaging-nats`](https://github.com/wasmCloud/wasmCloud/tree/main/crates/provider-messaging-nats), [`messaging-kafka`](https://github.com/wasmCloud/wasmCloud/tree/main/crates/provider-messaging-kafka), or a custom one)

If deploying with the [wasmCloud Application Deployment Manager (`wadm`)](https://github.com/wasmCloud/wadm), you can use `wadm.yaml` to deploy these pieces automatically via the [included WADM manifest](https://github.com/wasmCloud/wasmCloud/blob/main/examples/rust/components/messaging-image-processor-worker/wadm.yaml) (i.e. by running `wash app deploy wadm.yaml`).

By default, the `blobstore-fs` and `messaging-nats` providers are used as they require no extra dependencies (ex. docker containers) to run infrastructure.

This component (the image processor) and the HTTP task manager component communicate via \[wRPC\]\[wrpc\] (and the [NATS messaging system powering wasmCloud](https://wasmcloud.com/docs/v1/deployment/nats/cluster-config/)), so there's no need to hit the external API, WebAssembly function calls are automatically transformed into low-latency distributed RPC invocations to the HTTP task manager.

## Prerequisites

- `cargo` >= 1.81
- [`wash`](https://wasmcloud.com/docs/v1/installation/) >=0.32.0

## Build

You can build this component with the [WAsmcloud SHell `wash`](https://wasmcloud.com/docs/v1/cli/):

console

```console
wash build
```

Note that if you'd like to build with `cargo` you need to specify the `--target` option:

console

```console
cargo build --target=wasm32-wasip1
```

## Launch

First start a new [wasmCloud host](https://wasmcloud.com/docs/v1/concepts/hosts/):

console

```console
wash up
```

> \[!NOTE\] This command won't return, so run open a new terminal to continue running commands

Next, deploy the local version of the application (which uses the WebAssembly binary built by `wash build`):

console

```console
wash app deploy ./local.wadm.yaml
```

Confirm that the application was deployed successfully:

console

```console
wash app get
```

## Using this component

Assuming the wasmCloud host has been started and the application is deployed, a few steps must be taken to trigger the worker to process a job.

### Create a job with the HTTP task manager

This component operates primarily on jobs, so it's required to create a job first that can be worked on.

See [the docs for the HTTP task manager](https://github.com/wasmCloud/wasmCloud/tree/main/examples/rust/components/http-task-manager) for more information on how it works, the basics will be covered below.

First, make sure the HTTP task manager is migrated:

console

```console
curl -X POST localhost:8000/admin/v1/db/migrate
```

Then, create a new job:

console

```console
curl \
    -X POST \
    "localhost:8000/api/v1/tasks/submit \
    --data-binary @- <<EOF
{
  "source": {
    "type": "default-image"
  },
  "destination": {
    "type": "blobstore",
    "path": {
      "bucket": "output",
      "key": "default.grayscaled.jpg"
    }
  },
  "image_format": "image/jpg",
  "operations": [
    {
      "type": "grayscale"
    }
  ]
}
EOF
```

> \[!NOTE\] The task above uses the *default* image for the component, which is [`wasmcloud-logo.jpg`](https://github.com/wasmCloud/wasmCloud/blob/main/examples/rust/components/messaging-image-processor-worker/wasmcloud-logo.jpg)

You will receive the Job (task) ID as output to the task submission.

### Send a message notifying the worker of the new job

The worker component expects incoming message to be JSON that are formatted to include the task to be executed.

An example of the JSON payload:

json

```json
{ "job_id": "..." }
```

> !\[NOTE\] See the `ImageProcessingRequest` struct in [`src/processing.rs`](https://github.com/wasmCloud/wasmCloud/blob/main/examples/rust/components/messaging-image-processor-worker/src/processing.rs) for the complete schema.

You can send the JSON payload via the \[`nats` client binary\]\[nats-client-binary\] to trigger the component, on the configured NATS subject (or Kafka Topic):

```
nats publish images.processing '{ "job_id": "......"}'
```

> \[!NOTE\] You may encounter errors, and it is best to monitor the wasmCloud host output for errors reported from the provider or host.

## Tests

You can run the full E2E test suite:

console

```console
cargo test
```

> \[!NOTE\] Ensure no other wasmCloud hosts are running before running the e2e tests.

Last updated on **Nov 20, 2026** by **Victor Adossi**
