«Fivebeans» и «Golang - библиотека начинающего»: разница между страницами

Материал из support.qbpro.ru
(Различия между страницами)
imported>Supportadmin
 
imported>Vix
(Новая страница: «'''ПОЛЕЗНОЕ:''' <hr> * [https://golangs.org/ Уроки для изучения Golang] * [https://metanit.com/go/tutorial/2.11.php Функции и их...»)
 
Строка 1: Строка 1:
beanstalkd client & worker daemon for node
'''ПОЛЕЗНОЕ:'''
 
<hr>
[https://www.npmjs.org/package/fivebeans оригинал]
* [https://golangs.org/ Уроки для изучения Golang]
 
* [https://metanit.com/go/tutorial/2.11.php Функции и их параметры]
==FiveBeansClient==
* [https://www.ibm.com/developerworks/ru/library/l-go_01/ Язык программирования go]
 
* [https://tproger.ru/translations/golang-basics/ Golang: основы для начинающих]
Heavily inspired by node-beanstalk-client, which is a perfectly usable client but somewhat dusty. I wanted more complete support of the beanstalkd protocol in a project written in plain javascript.
* [http://golang-book.ru/ Введение в программирование на Go]
 
* [https://medium.com/golang-notes/%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0-visual-studio-code-%D0%B4%D0%BB%D1%8F-go-647ea94aa795 Настройка Visual Studio Code для Go]
All client method names are the same case & spelling as the beanstalk text command, with hyphens replaced by underscore. The single exception is delete, which is renamed to destroy().
* [https://serverspace.by/support/help/ustanovka-go-na-windows-server/ Установка GoLang на Windows Server]
 
* [https://otus.ru/nest/post/1015/ GOPATH и GOROOT больше не нужны?]
For complete details on the beanstalkd commands, see its protocol documentation.
* [https://nuancesprog.ru/p/5966/ Идеальная настройка вашего Golang проекта]
 
* [https://habr.com/ru/post/249449/ Кросс-компиляция в Go]
===Creating a client===
* [https://gobyexample.com/ Go by Example]
 
* [https://golang.org/pkg/ Golang Packages]
The client constructor takes two arguments:
 
*host: The address of the beanstalkd server. Defaults to 127.0.0.1.
*port: Port to connect to. Defaults to 11300.
 
The client emits three events that you should listen for: connect, error, and close.
 
The client is not usable until you call its connect() method. Here's an example of setting up a client:
 
<nowiki>var fivebeans = require('fivebeans');
 
var client = new fivebeans.client('10.0.1.1', 11300);
client
    .on('connect', function()
    {
        // client can now be used
    })
    .on('error', function(err)
    {
        // connection failure   
    })
    .on('close', function()
    {
        // underlying connection has closed
    })
    .connect();</nowiki>
 
===Producing jobs===
====use====
 
client.use(tube, function(err, tubename) {});
 
Use the specified tube. Reponds with the name of the tube being used.
 
====list_tube_used====
 
client.list_tube_used(function(err, tubename) {});
 
Responds with the name of the tube currently being used by the client.
 
====put====
 
client.put(priority, delay, ttr, payload, function(err, jobid) {});
 
Submit a job with the specified priority (smaller integers are higher priority), delay in seconds, and allowed time-to-run in seconds. The payload contains the job data the server will return to clients reserving jobs; it can be either a Buffer object or a string. No processing is done on the data. Responds with the id of the newly-created job.
 
====peek_ready====
 
client.peek_ready(function(err, jobid, payload) {});
 
Peek at the data for the job at the top of the ready queue of the tube currently in use. Responds with the job id and payload of the next job, or 'NOT_FOUND' if there are no qualifying jobs in the tube. The payload is a Buffer object.
 
====peek_delayed====
 
client.peek_delayed(function(err, jobid, payload) {});
 
Peek at the data for the delayed job with the shortest delay in the tube currently in use. Responds with the job id and payload of the next job, or 'NOT_FOUND' in err if there are no qualifying jobs in the tube. The payload is a Buffer object.
 
====peek_buried====
 
client.peek_buried(function(err, jobid, payload) {});
 
Peek at the data for the next buried job in the tube currently in use. Responds with the job id and payload of the next job, or 'NOT_FOUND' in err if there are no qualifying jobs in the tube. The payload is a Buffer object.
 
===Consuming jobs===
===Server statistics===
==FiveBeansWorker==
===API===
====constructor====
===Events===
===Jobs===
===Handlers===
===Example===
==FiveBeansRunner==
===bin/beanworker===
===Configuration file===

Версия от 09:13, 18 августа 2020