World Conquest Chronicles

World Conquest Chronicles

go-exercises-worker, v1.0-alpha

Background worker of the service for solving programming exercises.

Alpha of the major version. Implementing of the consuming of the solutions, the producing of the solution results, and the dummy solution runner.

Features

  • interaction with queues:
    • common properties:
      • automatic declaring of the used queues;
      • passing of a message data in JSON;
    • operations:
      • consuming of the solutions:
        • concurrent handling;
        • requeue the solution on failure;
      • producing of the solution results;
  • solution runners:
    • dummy solution runner (returns the current timestamp as the result).

Installation

Prepare the directory:

$ mkdir --parents "$(go env GOPATH)/src/github.com/thewizardplusplus/"
$ cd "$(go env GOPATH)/src/github.com/thewizardplusplus/"

Clone this repository:

$ git clone https://github.com/thewizardplusplus/go-exercises-worker.git
$ cd go-exercises-worker

Install dependencies with the dep tool:

$ dep ensure -vendor-only

Build the project:

$ go install ./...

Usage

$ go-exercises-backend

Environment variables:

  • MESSAGE_BROKER_ADDRESSRabbitMQ connection URI (default: amqp://rabbitmq:rabbitmq@localhost:5672);
  • SOLUTION_CONSUMER_BUFFER_SIZE — solution consumer channel capacity (default: 1000);
  • SOLUTION_CONSUMER_CONCURRENCY — amount of solution consumer threads (default: 1000).

Repository

Link: https://github.com/thewizardplusplus/go-exercises-worker/tree/v1.0-alpha.

Content: code.

License: MIT.