> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Magento 2 Order Subscriber

> Configuration-based replacement for the prototype magento2-order-subscriber in the Legacy Magento 2 Connector.

## Overview

The **Magento 2 Order Subscriber** is a configuration-based subscriber that listens for order-related events from a Magento 2 source system. It replaces the deprecated prototype-based `magento2-order-subscriber` previously used in the Legacy Magento 2 Connector.

<Info>
  This component has been migrated from a prototype-based implementation to a configuration-based setup as part of the Legacy Magento 2 Connector replacement project.
</Info>

## Prototype vs Configuration-based

<Warning>
  This is an important behavioral difference to understand before setting up this component.
</Warning>

|                  | Prototype-based                                               | Configuration-based                                                 |
| ---------------- | ------------------------------------------------------------- | ------------------------------------------------------------------- |
| **Reusability**  | Can be reused across different flows by changing a few fields | Not reusable across different purposes or payloads                  |
| **Flexibility**  | One prototype can serve multiple use cases                    | (Not always) Each use case requires its own dedicated configuration |
| **How to reuse** | Modify fields directly                                        | Duplicate the configuration and adjust as needed                    |

If you need to handle a different payload structure or use case, you must **duplicate** this Subscriber and adjust the configuration accordingly. Do not modify an existing configuration as another Route already uses it.

## Type

**Subscriber**

## Purpose

This Subscriber listens to incoming order data from Magento 2 and triggers the appropriate Route for further processing. It acts as the entry point for order-related integration flows.

## Configuration

| Parameter          | Description                                                        | Required |
| ------------------ | ------------------------------------------------------------------ | -------- |
| `store_code`       | The Magento 2 Store Code                                           | Yes      |
| `http-client`      | The HTTP Client Authentication method used to connect to Magento 2 | Yes      |
| `mutation-storage` | The storage to set the mutation date                               | Yes      |
| `entity-schema`    | The specific schema for the entity                                 | No       |
| `limit`            | The limit of the items                                             | No       |
| `start-date`       | The start date                                                     | No       |

## Usage

1. Navigate to **Subscribers** in your Alumio environment.
2. Search for or create a new **Magento 2 Order Subscriber**.
3. Configure the required parameters as described above.
4. Attach this Subscriber to the relevant route as the Incoming configuration.

## Deprecated VS New

An example of the deprecated configuration:

<Frame>
  <img src="https://mintcdn.com/alumio/i_0oO_KC23VzYTWk/images/image-381-legacy-m2.png?fit=max&auto=format&n=i_0oO_KC23VzYTWk&q=85&s=9e765e1ac59e889cb2e762f1a2513bb5" alt="Image" width="1100" height="453" data-path="images/image-381-legacy-m2.png" />
</Frame>

An example of the new configuration:

<Frame>
  <img src="https://mintcdn.com/alumio/i_0oO_KC23VzYTWk/images/image-382-legacy-m2.png?fit=max&auto=format&n=i_0oO_KC23VzYTWk&q=85&s=a0dc4ee70cf3bc193b7f572f782ef53b" alt="Image" width="1083" height="1530" data-path="images/image-382-legacy-m2.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/alumio/i_0oO_KC23VzYTWk/images/image-383-legacy-m2.png?fit=max&auto=format&n=i_0oO_KC23VzYTWk&q=85&s=41a3f074239deb305d780f56fe124632" alt="Image" width="929" height="1114" data-path="images/image-383-legacy-m2.png" />
</Frame>

## Notes

* Replaces the prototype: `magento2-order-subscriber`
* Unlike the prototype-based implementation, this configuration-based subscriber is **not reusable across different purposes or payloads**. If you need to handle a different payload structure or use case, you must duplicate this Subscriber and adjust the configuration accordingly.
* Ensure the Magento 2 API credentials are correctly configured before activating this Subscriber.
* For large order volumes, tune the `limit` parameter to avoid timeouts.
