Shanmugam Dhanapal Posted January 28, 2021 Posted January 28, 2021 Want to publish an event with JSON payload from BE 5.3. Unable to find a solution in documentation. Please let us know how to do it. Thanks.
Jim Mulcahey Posted March 30, 2021 Posted March 30, 2021 One option is to create a 'Timer Event' with an interval, and add a rule that is triggered by this Timer Event. However, this optioncan't work in a multi-agent Cache OM cluster environment. A more robust solution is to use a rule-based scheduler. A typical test setup involves the need to publish JMS messgaes to a queue or topic at a specified interval. I do this by creating a scheduler in a startup rule function. So I have a rule function named 'ScheduleJmsPublisher.rulefunction' with the following body: body { String sSchedulerName = "SendToJmsScheduler"; String sSchedulerWorkKey = "PositionResponseStatus"; String extId = "12345"; String payload = "{"BookTitle":"Finnegans Wake","BookAuthor":"James Joyce","BookPrice":25.99}"; long iFrequencyMsec = 1000; // every second Cluster.createScheduler(sSchedulerName,iFrequencyMsec,iFrequencyMsec); Events.SendToJms sendToJms = Events.SendToJms.SendToJms(extId,payload); Cluster.scheduleRepeatingEvent(sSchedulerName,sSchedulerWorkKey,sendToJms,DateTime.now(),iFrequencyMsec); }Here, I'm sending a json payload every second to my JMS server. I have an event named 'SendJsonPayload' defined with its default destination set to the queue/topic I want to send to (which is done in my JMS Channel configuration). After adding this rule function, I open my project's CDD in the CDD Editor in Studio, and go to the 'Agent Classes' tab. Under 'Startup Functions', I add my ScheduleJmsPublisher rule function. So each time the inference agent is started, JMS messages will be published once every second. Again, this solution only works when you're using Cache object management. You should set the following properties for your cache agents: be.engine.cluster.scheduler=false be.engine.cacheServer.channel.disable=trueThis will ensure that the cache agents don't try acting as schedulers, and will not attempt to connect to the JMS destination. Hope this helps. -Jim
GrowExx pvt. Ltd. Posted December 22, 2022 Posted December 22, 2022 As per my understanding,To Publish a JSON Message. Log in to the management console. Click on the upper left to select the desired region and project. Under Management & Governance, select Simple Message Notification. The SMN console is displayed. In the navigation pane, choose Topic Management > Topics. The Topics page is displayed.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now