cb_publish in PostgreSQLDatabasePublisher

18 views
Skip to first unread message

Jimmy Jia

unread,
Nov 18, 2014, 8:57:09 PM11/18/14
to autob...@googlegroups.com
Hi,

I see that the PostgreSQLDatabasePublisher class references a cb_publish function:


However, I couldn't find a definition of this function in the code. Additionally, the examples use syntax that are only available in the PostgreSQL beta and not the current released version. I tried to implement a basic version of cb_publish myself to provide this functionality to my tools:

CREATE OR REPLACE FUNCTION cb_publish(
  topic  VARCHAR
,
  args   JSON DEFAULT
'[]',
  kwargs JSON DEFAULT
'{}'
)
  RETURNS VOID
AS
  $$
 
BEGIN
    PERFORM
      pg_notify
(
         
'crossbar_pubsub_event',
          row_to_json
(x) :: VARCHAR
     
)
    FROM
     
(SELECT
         
'direct' AS "type",
         topic    AS topic
,
         args     AS args
,
         kwargs   AS kwargs
     
) x;
 
END;
  $$
LANGUAGE plpgsql
;

Does this look like it would work as expected, or am I missing something?

Thanks,
Jimmy Jia

Jimmy Jia

unread,
Nov 21, 2014, 9:49:52 AM11/21/14
to autob...@googlegroups.com
Not sure what happened with this email - I wrote it a few days ago - it didn't send initially, and I decided to ask the same question on another thread instead. Please ignore this.

--
You received this message because you are subscribed to a topic in the Google Groups "Autobahn" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/autobahnws/D2gukCYaEG4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to autobahnws+...@googlegroups.com.
To post to this group, send email to autob...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/a07696c5-0ffa-4f5b-8c50-afd44f5d8b81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tobias Oberstein

unread,
Nov 21, 2014, 12:23:31 PM11/21/14
to autob...@googlegroups.com
Am 21.11.2014 15:49, schrieb Jimmy Jia:
> Not sure what happened with this email - I wrote it a few days ago - it
> didn't send initially, and I decided to ask the same question on another
> thread instead. Please ignore this.

Hi Jimmy,

Google Groups occasionally decides that a post would be spam. I now
released 2 posts of you that got stuck in the spam queue and marked your
mail address as "never spam" (the latter however still sometimes does
not work as expected).

Tobias
> <mailto:autobahnws+...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> <https://groups.google.com/d/msgid/autobahnws/a07696c5-0ffa-4f5b-8c50-afd44f5d8b81%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/CALFTs%3DdPAxADoPToA5%2B%2B%3D5P-_nPvpiqFvjkBYb5WqaTmZ4eTuQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/autobahnws/CALFTs%3DdPAxADoPToA5%2B%2B%3D5P-_nPvpiqFvjkBYb5WqaTmZ4eTuQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages