Thanks Brian,

I will look into websocket API.

Since this is on JS/browser, is there anything that can be done for security

-Dweep

On Wed, Oct 16, 2019 at 1:43 PM Brian Candler <[email protected]> wrote:

> On 16/10/2019 08:35, Dweep Sharma wrote:
>
> From the docs, it seems  every time a producer needs to be created for
> publishing a message, which involves a connection
>
> Is there a REST API which can be used to simply POST a message to a topic
> instead ?
>
> You do realise that making a HTTP POST also involves making a new
> connection each time? (Unless the client uses HTTP keepalive to hold the
> connection open for a while).
>
> What's the problem you're trying to solve?
>
>
> If not, does it make sense to use a client library, hosted as a Lambda
> function + API gateway
>
> It might make sense if the client which wants to talk to Pulsar doesn't
> have a Pulsar client library available.  However, there are some things
> about Pulsar architecture you need to beware of.
>
> Producers are responsible for generating sequential message IDs
> <https://pulsar.apache.org/docs/en/concepts-messaging/>, and each
> producer needs a unique name to distinguish its message IDs from any other
> producer. You can't have multiple connections open with the same producer
> name.
>
> Lambda functions scale up and down on demand, so the number of producers
> you have will vary.  By default, each time the lambda function starts it
> will generate a random producer name and start its own message ID sequence
> from scratch, until it dies.  This will work for simple message delivery,
> as long as you don't care about messages being delivered in-order or
> deduplication.  The way deduplication works is that you need to present the
> same producer name and message ID.  Each separate HTTP client POST will
> land on an arbitrary member of your pool of lambda functions / producers;
> and the original producer may no longer be running anyway.
>
> If the problem is that you want Javascript running in a web browser to
> talk to Pulsar, you would probably be better off using the WebSocket API
> <https://pulsar.apache.org/docs/en/client-libraries-websocket/>.
> To support languages which don't have a Pulsar client API available, you'd
> still likely be better off finding a WebSocket client library for that
> language, rather than try to bolt a REST frontend onto Pulsar.
>
> Regards,
>
> Brian.
>

-- 
*::DISCLAIMER::

----------------------------------------------------------------------------------------------------------------------------------------------------


The contents of this e-mail and any attachments are confidential and 
intended for the named recipient(s) only.E-mail transmission is not 
guaranteed to be secure or error-free as information could be intercepted, 
corrupted,lost, destroyed, arrive late or incomplete, or may contain 
viruses in transmission. The e mail and its contents(with or without 
referred errors) shall therefore not attach any liability on the originator 
or redBus.com. Views or opinions, if any, presented in this email are 
solely those of the author and may not necessarily reflect the views or 
opinions of redBus.com. Any form of reproduction, dissemination, copying, 
disclosure, modification,distribution and / or publication of this message 
without the prior written consent of authorized representative of redbus. 
<http://redbus.in/>com is strictly prohibited. If you have received this 
email in error please delete it and notify the sender immediately.Before 
opening any email and/or attachments, please check them for viruses and 
other defects.*

Reply via email to