Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRC: Built-in message queue for event subscribe #28

Closed
jiangyy0824 opened this issue Mar 13, 2019 · 3 comments
Closed

TRC: Built-in message queue for event subscribe #28

jiangyy0824 opened this issue Mar 13, 2019 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@jiangyy0824
Copy link
Contributor

jiangyy0824 commented Mar 13, 2019

tip: 28
title: TRC-28 Built-in message queue for event subscribe
author: jiangyy [email protected]
discussions to: #28
status: accepted
type: Standards Track
category: TRC
created: 2019-03-14

Simple Summary
Adding built-in message queue for event subscribe in java-tron.

Abstract
The built-in message queue is designed for event subscribe. Developers could subscribe triggers directly from fullnode without event plugin.

Motivation
Developers could use event plugins to subscribe triggers from fullnode, which provide very reliable service and store very large amount of data.

But in some cases, developers want to subscribe directly from fullnode, with short-term subscriptions. Native message queue is implemented to meet such requirement.

Specification
The function of native queue is configurable. It's is disabled by default. It shared the configuration of triggers with eventplugin.

The communication channel between fullnode and subscription client is socket. The bindport could be configurable to avoid conflicting.

event.subscribe = {
native = {
useNativeQueue = true // if true, use native message queue, else use event plugin.
bindport = 5555 // bind port
sendqueuelength = 1000 //max length of send queue
}
......
}

Developers should subscribe triggers very conveniently. What they need to do is: connecting to the port, subscribing the topics, then receivingthe triggers.

@jiangyy0824 jiangyy0824 changed the title TRC: Native message queue for event subscribe TRC: Built-in message queue for event subscribe Apr 2, 2019
@jiangyy0824 jiangyy0824 self-assigned this Apr 2, 2019
@jiangyy0824 jiangyy0824 added the enhancement New feature or request label Apr 2, 2019
@neshala
Copy link

neshala commented Jan 4, 2021

How exactly I can subscribe to the topic?

I have tried to send this JSON variable in order to subscribe, but no lack:

{"triggerName": "block", enable: true, "topic": "block"}
or
{"triggerName":"block"}
or
{"id": 1, "method": "block", "params": [""]}
or just
{"block"}

but none from above is working for me and I have enabled block topic in main config.

@CerberusGR
Copy link

Does anybody has an example?
Why native queue server not running (port 5555 is not opened).

@surindergiri
Copy link

Hi,
I am also facing same issue, enabled native events within Tron Node and trying to get contract events using below code in NodeJs.

this.tronWeb.getEventByTransactionID(txid).then(async result => {
      console.log('getEventByTransactionID  :: result :: ', result);
      return result;
    }).catch((err) => {
      console.log('ERROR getEventByTransactionID :: ', err);
      return false;
    });

When I run the code then it return "parse error".
Did you figure out what exactly is the code format to subscribe contract events using Tron node native events?

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants