1.3.2 • Published 5 years ago
content-ingest-images-v1 v1.3.2
Content Ingest: Images (v1)
Service for ingesting Image Metadata (v1) sourced content.
The service subscribes to a RabbitMQ queue from the Images Domain Exchange.
Usage
You need node.js installed globally:
Run
To run the service please use the following;
$ npm install
$ npm start
Unit Tests
Unit tests are run using the mocha framework.
Run unit tests;
$ npm test
or to report using junit-compatible xml reporting;
$ npm run test:ci
Examples
Notification endpoint -/notify
This endpoint provides the ability to manually ingest image metadata items, this will primarily be used for testing purposes.
The following REST endpoint will simulate the processing of Notification.
curl -X POST -H "Content-Type: application/json" -d '{
"id": "e17f96c2-f02c-428d-845d-6a10758e82f0",
"timestamp": "2017-04-06T13:20:16Z",
"key": "item.create.2.30123321",
"domain": "images",
"type": "item",
"operation": "create",
"entity": {
"uri": "2.30123321",
"version": "1",
"type": "picture",
"profile": "picture",
"firstcreated": "2017-04-06T13:20:08Z",
"versioncreated": "2017-04-06T13:20:08Z",
"urgency": 6,
"pubstatus": "usable",
"object": [
{
"code": "paimagescopyright:226",
"rel": "classifiedAs",
"scheme": "http://image-metadata-repository.api.press.net/v1/object",
"name": "Image copyright code"
}
],
"subject": [
{
"code": "paimagescategory:s"
},
{
"code": "paimagescategory:supplemental:motorcycling"
}
]
},
"origin": {
"name": "repository/image-metadata-repository/v1",
"address": "10.10.10.10",
"port": 3097
}
}' "http://<host>:<port>/ingest/content/images/v1/notify"
Docker
Build
Build the Docker image
$ docker build --build-arg NPM_TOKEN=<YOUR_NPM_TOKEN> -t pressassociation/content-ingest-images-v1 .
Run
Run the Docker image in a new container
$ docker run \
-p <PORT>:8005 \
-e ZOOKEEPER_CONNECTION_STRING="<ZOOKEEPER_HOST>:<ZOOKEEPER_PORT>" \
-e IMAGE_API_HOST_NAME="<IMAGE_API_HOST_NAME>" \
-e IMAGE_API_PATH="<IMAGE_API_PATH>" \
-e IMAGE_API_KEY="<IMAGE_API_KEY>" \
-e IMAGES_BASE_URL="<IMAGES_BASE_URL>" \
pressassociation/content-ingest-images-v1