Skip to content

Apache Camel Introduction

Online Grocery Store Issues

The Bigbasket in India, a large online grocery store, is facing software maintenance problems and has invited the design of an IT solution. For the past ten years, the store has been accepting online orders for different products, which are then distributed to the respective suppliers.

Order Placement Formats

The store initially accepted orders in a comma-separated plain text file. It then switched to message-driven order placement and then to an XML based order placement. Finally, the store adopted a web service interface. As a result, orders now come in different formats, and the store is required to maintain these various formats.

Scalability Issues

The business has been growing steadily, and the store has had to periodically add new suppliers to its repertoire. Each supplier has its own protocol for accepting orders, creating the need for a scalable application architecture to accommodate them.

The entire situation is shown in the following figure −

Apache Camel Introduction

We’ll assume that orders placed online are in XML format. Here is an example order file format we’ll use in this tutorial:

<OrderID>
    <Order number="001">
        <Product type="Soaps">
            <Item>
                <Brand>Cinthol</Brand>
                <Type>Original</Type>
                <Quantity>4</Quantity>
                <Price>25</Price>
            </Item>
            <Item>
                <Brand>Cinthol</Brand>
                <Type>Lime</Type>
                <Quantity>6</Quantity>
                <Price>30</Price>
            </Item>
        </Product>
        <Product type="Oil">
            <Item>
                <Brand>Saffola</Brand>
                <Type>Gold</Type>
                <Quantity>2</Quantity>
                <Price>649</Price>
            </Item>
            <Item>
                <Brand>Fortune</Brand>
                <Type>Sunlite</Type>
                <Quantity>1</Quantity>
                <Price>525</Price>
            </Item>
        </Product>
        <Product type="Milk">
            <Item>
                <Product>Milk</Product>
                <Brand>Amul</Brand>
                <Type>Pure</Type>
                <Quantity>2</Quantity>
                <Price>60</Price>
            </Item>
        </Product>
    </Order>
</OrderID>

Output of this program will be

Order 001 Product: Soaps Brand: Cinthol Type: Original Quantity: 4 Price: 25 Brand: Cinthol Type: Lime Quantity: 6 Price: 30 Product: Oil Brand: Saffola Type: Gold Quantity: 2 Price: 649 Brand: Fortune Type: Sunlite Quantity: 1 Price: 525 Product: Milk Brand: Amul Type: Pure Quantity: 2 Price: 60

Leave a Reply

Your email address will not be published. Required fields are marked *