[ejabberd] mod_pubsub.erl -> publishing ejabberd console vs attached console

Robert Latko robert at lmi-global.com
Tue Aug 29 22:26:56 MSK 2017


Hi all,

I'm using e17.03, 4 node cluster on U16.04LTS, Riak, AWS EC2's...

I wanted to post a status message to a PubSub node at regular intervals.

I could either #1.) Use /etc/crontab with an escript (method described 
below) or #2.) use mod_cron.erl (which wasnt working so well in 17.03)

Today I was able to achieve my objectives with hacking method #2.

Robert




On 08/28/2017 03:26 PM, Robert Latko wrote:
> Hi all,
>
> I am trying to attach a console to ejabberd and then publish an item. 
> I get nif_not_loaded errors.
>
> Does anyone know why the NIFs aren't loading?
>
> mod_pubsub.erl exports publish_item/6 so one can publish an item via a 
> live console. This works when I try it (with the below code)
>
> Attaching a console cops  nif_not_loaded error (I also tried this with 
> an escript and gives same errors).
>
> I put some io:formats in to debug: S:<<"pubsub.localhost">>**is one in 
> call from jid:nameprep/1 (src/jid.erl, line 239).
>
> I've seen this before with stringprep; however I sincerely believe it 
> is loaded (I put loaded pats output below).
>
> Here is the process I am using.
>
> (testclient at a-backendfleet.remarketer.com)4> net_adm:ping([secret]).
> pong
> (testclient at a-backendfleet.remarketer.com)5> nodes().
> ['ejabberd@[secret]','[secret]', 
> 'ejabberd@[secret]','ejabberd@[secret]', 'ejabberd@[secret]']
> (testclient@[secret])6> Host = <<"pubsub.localhost">>.
> <<"pubsub.localhost">>
> (testclient@[secret])7> ServerHost = <<"localhost">>.
> <<"localhost">>
> (testclient@[secret])8> Node= <<"newbobsnode2">>.
> <<"newbobsnode2">>
> (testclient@[secret])9> Publisher = 
> {jid,<<"test3570784">>,<<"localhost">>,<<"7393319534606061449158">>,<<"test3570784">>,<<"localhost">>,<<"7393319534606061449158">>}.
> {jid,<<"test3570784">>,<<"localhost">>,
> <<"7393319534606061449158">>,<<"test3570784">>,
> <<"localhost">>,<<"7393319534606061449158">>}
> (testclient@[secret])10> ItemId = <<"ymd3ike6y8lD">>.
> <<"ymd3ike6y8lD">>
> (testclient at a-backendfleet.remarketer.com)11> Payload = 
> [{xmlel,<<"entry">>,[{<<"xmlns">>,<<"http://www.[secret].im/xmlns">>}],[{xmlel,<<"type">>,[],[{xmlcdata,<<"[secret]">>}]},{xmlel,<<"link">>,[],[]},{xmlel,<<"[secret]">>,[],[{xmlcdata,<<"testC">>}]},{xmlel,<<"[secret]">>,[],[{xmlcdata,<<"this 
> is 
> test6">>}]},{xmlel,<<"published">>,[],[{xmlcdata,<<"2017-08-28T17:21:08.701Z">>}]}]}].
> [{xmlel,<<"entry">>,
>         [{<<"xmlns">>,<<"http://www.ekho.im/xmlns">>}],
> [{xmlel,<<"type">>,[],[{xmlcdata,<<"wtb">>}]},
>          {xmlel,<<"link">>,[],[]},
> {xmlel,<<"subject">>,[],[{xmlcdata,<<"testC">>}]},
>          {xmlel,<<"body">>,[],[{xmlcdata,<<"this is test6">>}]},
>          {xmlel,<<"published">>,[],
> [{xmlcdata,<<"2017-08-28T17:21:08.701Z">>}]}]}]
> (testclient@[secret])12> mod_pubsub:publish_item(Host, ServerHost, 
> Node, Publisher, ItemId, Payload).
> *S:<<"pubsub.localhost">>*
> *** exception error: nif_not_loaded*
>      in function  erlang:nif_error/1
>         called as erlang:nif_error(nif_not_loaded)
> *in call from stringprep:nameprep/1 (src/stringprep.erl, line 60)*
>      in call from jid:nameprep/1 (src/jid.erl, line 239)
>      in call from ejabberd_router:host_of_route/1 
> (src/ejabberd_router.erl, line 201)
>      in call from mod_pubsub:transaction/3 (src/mod_pubsub.erl, line 3687)
>      in call from mod_pubsub:publish_item/8 (src/mod_pubsub.erl, line 
> 1923)
> (testclient at a-backendfleet.remarketer.com)13>
>
>
>                                   "//lib/xmpp-1.1.9/ebin",
>                                   "//lib/stun-1.0.10/ebin",
>                                   "//lib/stringprep-1.0.8/ebin",
> "//lib/riakc-2.1.1-13-g527722d/ebin",
>                                   "//lib/riakc-2.4.1/ebin",
>                                   "//lib/riak_pb-2.1.4.1/ebin",
> "//lib/protobuffs-0.8.2-4-g6e7fc92/ebin",
>                                   "//lib/protobuffs-0.8.4/ebin",
>                                   "//lib/p1_xmlrpc-1.15.1/ebin",
>                                   "//lib/p1_utils-1.0.7/ebin",
>                                   "//lib/p1_oauth2-0.6.1/ebin",
>                                   "//lib/meck-0.8.2/ebin",
>                                   "//lib/luerl-1/ebin",
>                                   "//lib/lager-3.2.1/ebin",
>                                   "//lib/jiffy-0.14.8/ebin",
>                                   "//lib/iconv-1.0.4/ebin",
> "//lib/hamcrest-0.3.0-basho/ebin",
>                                   "//lib/hamcrest-0.1.0/ebin",
>                                   "//lib/goldrush-0.1.8/ebin",
>                                   "//lib/fast_yaml-1.0.9/ebin",
>                                   "//lib/fast_xml-1.1.21/ebin",
>                                   "//lib/fast_tls-1.0.11/ebin",
>                                   "//lib/ezlib-1.0.2/ebin",
>                                   "//lib/esip-1.0.11/ebin",
>                                   "//lib/ejabberd-17.03/ebin",
>                                   "//lib/cache_tab-1.0.7/ebin",
>
>
>
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20170829/44cba196/attachment.html>


More information about the ejabberd mailing list