content-rw-neo4j

command module
v3.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 11 Imported by: 0

README

Content Reader/Writer for Neo4j (content-rw-neo4j)

Circle CI Go Report Card Coverage Status

An API for reading/writing Content into Neo4j. Expects the content JSON supplied by the ingester.

Installation

Download the source code, dependencies, and build the binary:

go get github.com/Financial-Times/content-rw-neo4j
cd $GOPATH/src/github.com/Financial-Times/content-rw-neo4j
go install

Running

Run unit tests only:

go test -v -race ./...

To execute the integration tests, you must provide GITHUB_USERNAME and GITHUB_TOKEN because the service depends on internal repositories:

GITHUB_USERNAME="<user-name>" GITHUB_TOKEN="<personal-access-token>" \
docker-compose -f docker-compose-tests.yml up -d --build && \
docker logs -f test-runner && \
docker-compose -f docker-compose-tests.yml down -v

To run the binary:

$GOPATH/bin/content-rw-neo4j \
   --neo-url={neo4jUrl} \
   --port={port} \
   --batchSize=50 \

All arguments are optional, run the following command to see the defaults:

$GOPATH/bin/content-rw-neo4j --help

Building

The application is continuously built by CircleCI.

The docker image of the service is built by Dockerhub based on the git release tag.

To prepare a new git release, go to the repo page on GitHub and create a new release.

Updating the Model

Currently we use a subset of the fields that we get from the Ingester but if more fields are needed to be pulled in then update the model.go

The flow of information is as follows: Kafka (CMSPublication) => Ingester => content-rw-neo4j

Content Types

Currently, the following content types are eligible for being written into Neo:

  • Article
  • ContentPackage
  • Content
  • Video
  • Graphic
  • Audio

Additionally, any content payloads which contain a body property, will be written to Neo.

API

Write content to Neo4j:

curl http://localhost:8080/content/:uuid -XPUT -H'Content-Type: application/json' --data '{"uuid":":uuid","body":"<body></body>"}'

Read content from Neo4j:

curl http://localhost:8080/content/:uuid'

Count content in Neo4j:

curl http://localhost:8080/content/__count'

Delete content from Neo4j:

curl http://localhost:8080/content/:uuid -XDELETE '

Please see the OpenAPI spec for details.

Logging

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL