Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

How to get Assembler pushing messages to messaging destination

Avatar

Not applicable
I have a CustomAssembler that extends AbstractAssembler and I was wondering if I could somehow push a AsyncMessage to a messaging service somehow.



I just don't know how to get a reference to the MessageService that is in charge of the messaging destination?



I know how to do this in a class that extends ServiceAdapter, I would do this:

MessageService msgService = (MessageService) service;

AsyncMessage msg = new AsyncMessage();

msg.setDestination("chat");

msgService.pushMessageToClients(msg, false);



So, basically how do I get a reference to the MessageService for one of my Messaging destinations from an Assembler?



-Dan
1 Reply

Avatar

Not applicable
I figured it out. The two lines below is what I needed.



MessageBroker msgBroker = MessageBroker.getMessageBroker(null);

MessageService msgService = (MessageService)msgBroker.getService("message-service");