shipping

package
v0.0.0-...-9a5c20e Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 4 Imported by: 1

README

shipping

import "github.com/blueprint-uservices/blueprint/examples/sockshop/workflow/shipping"

Package shipping implements the SockShop shipping microservice.

All the shipping microservice does is push the shipment to a queue. The queue-master service pulls shipments from the queue and "processes" them.

Index

type Shipment

Represents a shipment for an order

type Shipment struct {
    ID     string
    Name   string
    Status string
}

type ShippingService

ShippingService implements the SockShop shipping microservice

type ShippingService interface {
    // Submit a shipment to be shipped.  The actual handling of the
    // shipment will happen asynchronously by the queue-master service.
    //
    // Returns the submitted shipment or an error
    PostShipping(ctx context.Context, shipment Shipment) (Shipment, error)

    // Get a shipment's status
    GetShipment(ctx context.Context, id string) (Shipment, error)

    // Update a shipment's status; called by the queue master
    UpdateStatus(ctx context.Context, id, status string) error
}

func NewShippingService
func NewShippingService(ctx context.Context, queue backend.Queue, db backend.NoSQLDatabase) (ShippingService, error)

Instantiates a shipping service that submits all shipments to a queue for asynchronous background processing

Generated by gomarkdoc

Documentation

Overview

Package shipping implements the SockShop shipping microservice.

All the shipping microservice does is push the shipment to a queue. The queue-master service pulls shipments from the queue and "processes" them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Shipment

type Shipment struct {
	ID     string
	Name   string
	Status string
}

Represents a shipment for an order

type ShippingService

type ShippingService interface {
	// Submit a shipment to be shipped.  The actual handling of the
	// shipment will happen asynchronously by the queue-master service.
	//
	// Returns the submitted shipment or an error
	PostShipping(ctx context.Context, shipment Shipment) (Shipment, error)

	// Get a shipment's status
	GetShipment(ctx context.Context, id string) (Shipment, error)

	// Update a shipment's status; called by the queue master
	UpdateStatus(ctx context.Context, id, status string) error
}

ShippingService implements the SockShop shipping microservice

func NewShippingService

func NewShippingService(ctx context.Context, queue backend.Queue, db backend.NoSQLDatabase) (ShippingService, error)

Instantiates a shipping service that submits all shipments to a queue for asynchronous background processing

Jump to

Keyboard shortcuts

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