Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Introduction

This wiki explains the design for fetching QR code images via DIAL Service

Background & Problem Statement

At the moment LERN Batch Service is connecting to cassandra ‘dialcodes.dialcode_images’ table for fetching QR Code Image URLs and also resolve image BLOB URL which is currently relative path. Ideally this information should be fetched from DIAL service owned by Knowlg BB as this keyspace is owned by knowlgBB. Hence, an API is to be developed where an image or multiple QR code Images information can be fetched from DIAL service.

Design

To resolve above problem,

Solution 1: New API can be published in DIAL Service ({{host}}/api/dialcode/v2/image/list) which will accept request in below format, reads data from cassandra ‘dialcodes.dialcode_images’ table and provides response in below format. Number of QR Codes as input to be controlled via a configuration 'qrimage_request_limit'.

{
    "request": {
        "dialcodes": ["Q1I5I3"]
    }
}
{
    "id": "sunbird.dialcode.images.list",
    "ver": "3.0",
    "ts": "2023-02-01T12:16:52Z+05:30",
    "params": {
        "resmsgid": "505bce18-1feb-44c3-91c3-07b8324de4f9",
        "msgid": null,
        "err": null,
        "status": "successful",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "qrcodeImagesInfo": [
            {
                "filename": "0_Q1I5I3",
                "channel": "b00bc992ef25f1a9a8d63291e20efc8d",
                "config": {},
                "createdOn": null,
                "dialcode": "Q1I5I3",
                "publisher": null,
                "status": 0,
                "url": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/in.ekstep/0_Q1I5I3.png"
            }
        ]
    }
}

Solution 2: Image URL can be synced to Elastic search of DIAL code document when the image is generated in the 'qrcode-image-generator' flink job. This needs syncing of already generated DIAL codes images for existing adopters.

LERN Batch Service code update:

Remove the database connection and connect to knowlg API for the image information in ‘QRCodeDownloadManagementActor.java’. Rest of the code flow (request and response) will remain intact.

  • No labels