Once you have extended GearMessage
and made GearMessagePublisher
available to the code that will send the message, then you just need to add sending code to the location in the gear where the event occurs.
The following is an example of the sending code, mentioned in Step 4 of Adding Custom Alert Messages to Gears above.
//Create DocumentCreated message DocumentCreatedMessage message = new DocumentCreatedMessage(gearEnv); ... //look up the publisher service try { GearMessagePublisher publisher = getPublisher(); If (publisher != null) { publisher.writeMessage(message); } } catch (JMSException jmse) { ... }