GithubHelp home page GithubHelp logo

isabella232 / stager-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cloudfoundry-attic/stager-client

0.0 0.0 0.0 176 KB

Cloud Foundry - the open platform as a service project

License: Apache License 2.0

Ruby 100.00%

stager-client's Introduction

VCAP Stager Client

Provides client implementations for queuing staging tasks. Currently, the following clients are provided:

EmAware

Intended to be used when dealing with EM directly.

Sample usage:

client = VCAP::Stager::Client::EmAware.new(nats_connection, queue)

# Send the request, wait up to 10 seconds for a result
deferrable = client.stage(request, 10)

# Block will be invoked on any reply that is received (regardless of
# whether or not the Stager succeeded or failed).
deferrable.callback { |r| puts "Received response: #{r}" }

# Block will be invoked when an error occurs while processing the request.
# This includes errors deserializing the response and timeouts waiting for
# a reply.
deferrable.errback { |e| puts "An error occurred: #{e}" }

FiberAware

Intended to be used with EM + Fibers. Emulates a blocking api by yielding the calling fiber until the request completes.

Sample usage:

Fiber.new do
  client = VCAP::Stager::Client::FiberAware.new(nats_connection, queue)

  begin
    # Send the request, wait for up to 10 seconds to reply. The current
    # fiber is resumed once the request has completed.
    result = client.stage(request, 10)
  rescue => e
    # Exceptions that occur while performing the request are raised in
    # the calling fiber.
    puts "An error, #{e}, occurred"
  end
end

File a Bug

Use the Github Issues feature in the appropriate repository to file a bug against Cloud Foundry Open Source and its components,

stager-client's People

Contributors

mreider avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.