C# 클래스 GoogleCloudSamples.Services.BookDetailLookup

A library for the background task of looking up a book in Google's books API.
파일 보기 프로젝트 열기: GoogleCloudPlatform/getting-started-dotnet 1 사용 예제들

공개 메소드들

메소드 설명
BookDetailLookup ( string projectId, Options options = null, ISimpleLogger logger = null ) : Google.Api.Gax
CreateTopicAndSubscription ( ) : void

Creates the topic and subscription, if they don't already exist. You should call this once at the beginning of your app.

EnqueueBook ( long bookId ) : void

Publish a message asking for a book to be processed.

ParseDate ( string dateString ) : DateTime?

Parse a date time. Return null if it can't be parsed. A single number will be interpreted as a year, and the date returned will be YEAR-01-01.

ProcessBook ( IBookStore bookStore, long bookId ) : void

Look up a book in Google's Books API. Update the book in the book store.

PullLoop ( Action callback, CancellationToken cancellationToken ) : void

Pulls books from the queue and invokes your callback for each book.

StartPullLoop ( IBookStore bookStore, CancellationToken cancellationToken ) : Task
UpdateBookFromJson ( string json, Book book ) : void

Updates book with information parsed from a json response from Google's Books API.

비공개 메소드들

메소드 설명
PullOnce ( Action callback, CancellationToken cancellationToken ) : void

Makes one call to PubSub.Pull to pull some books from the subscription.

메소드 상세

BookDetailLookup() 공개 메소드

public BookDetailLookup ( string projectId, Options options = null, ISimpleLogger logger = null ) : Google.Api.Gax
projectId string
options Options
logger ISimpleLogger
리턴 Google.Api.Gax

CreateTopicAndSubscription() 공개 메소드

Creates the topic and subscription, if they don't already exist. You should call this once at the beginning of your app.
public CreateTopicAndSubscription ( ) : void
리턴 void

EnqueueBook() 공개 메소드

Publish a message asking for a book to be processed.
public EnqueueBook ( long bookId ) : void
bookId long
리턴 void

ParseDate() 공개 정적인 메소드

Parse a date time. Return null if it can't be parsed. A single number will be interpreted as a year, and the date returned will be YEAR-01-01.
public static ParseDate ( string dateString ) : DateTime?
dateString string A string representation of the date.
리턴 DateTime?

ProcessBook() 공개 메소드

Look up a book in Google's Books API. Update the book in the book store.
public ProcessBook ( IBookStore bookStore, long bookId ) : void
bookStore IBookStore Where the book is stored.
bookId long The id of the book to look up.
리턴 void

PullLoop() 공개 메소드

Pulls books from the queue and invokes your callback for each book.
public PullLoop ( Action callback, CancellationToken cancellationToken ) : void
callback Action This callback will be invoked for every book. /// Must be thread safe.
cancellationToken System.Threading.CancellationToken Stop looking by cancelling this token. /// Must not be null.
리턴 void

StartPullLoop() 공개 메소드

public StartPullLoop ( IBookStore bookStore, CancellationToken cancellationToken ) : Task
bookStore IBookStore
cancellationToken System.Threading.CancellationToken
리턴 Task

UpdateBookFromJson() 공개 정적인 메소드

Updates book with information parsed from a json response from Google's Books API.
public static UpdateBookFromJson ( string json, Book book ) : void
json string A response from Google's Books API.
book GoogleCloudSamples.Models.Book Fields in book will be overwritten.
리턴 void