21
loading...
This website collects cookies to deliver better user experience
prices/java/stocks/{ticker}
). This allows our subscribers to consume the messages via topic subscriptions mapped to queues. For example, thre’s a queue called queue_java_consumer
for java consumer and added a topic subscription prices/>
. This will allow messages published by both REST and Java publishers to be enqueued in this queue.queue_rest_consumer
with a different topic subscription prices/rest/>
. This means only messages published by the REST publisher will be enqueued in this queue.queue_java_consumer
with topic prices/>
mapped to itqueue_rest_consumer
with topic prices/rest/
mapped to itprices/rest/stocks/aapl
, run this command:curl -X POST http://127.0.0.1:9000/prices/rest/stocks/aapl --header "Content-Type: application/json" -d '{"name":"aapl", "price":"130"}'
http(s)://:/
prices/java/stocks/aapl
.> bash sdkperf_java.sh -ptl="prices/java/stocks/aapl" -mt=persistent -mn=10000 -mr=1 -msa=100 -cip=localhost:55555
from flask import Flask, json, request
from flask import *
companies = [{"name": "ibm", "price": 134}, {"name": "msft", "price": 255}]
api = Flask( __name__ )
@api.route('/', methods=['GET'])
def get_companies():
return json.dumps(companies)
@api.route('/', methods=['POST'])
def post_companies():
name = request.args.get("name")
price = request.args.get("price")
print(json.dumps(request.json))
return json.dumps(request.json), 201
if __name__ == ' __main__':
api.run(host='0.0.0.0')
[{"name": "ibm", "price": 134}, {"name": "msft", "price": 255}]
$ curl -X POST -H "Content-Type: application/json" -d '{"name":"nvda","price":"609"}' http://ec2-34-201-735.compute-1.amazonaws.com:5000
{"name": "nvda", "price": "609"}
REST consumer
, queue binding
, and REST delivery point(RDP)
.GET
commands. That wouldn’t be appropriate given that Solace PubSub+ is all about event-driven architecture. Instead, PubSub+ utilizes REST WebHooks via POST
commands so that the updates are pushed in real-time.POST
or PUT
).http://ec2-34-201-77-35.compute-1.amazonaws.com:5000/
./
, set Post Request Target
to that.sdkperf-jcsmp
to spin up a Java consumer quickly via this command:> bash sdkperf_java.sh -cip=localhost:55555 -sql=queue_java_consumer -md -pe
queue_java_consumer
queue you created earlier.prices/java/stocks/aapl
.prices/rest/stocks/aapl
and was enqueued in the queue queue_rest_consumer
. As soon as the message was enqueued, the configured endpoint was invoked which resulted in the webservice logging that output.21