A comment was added to the live docs example:
http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcds/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=messaging_config_5.html#258500

that corrects this. 

MessageService msgService = (MessageService)service;

Should be:

MessageService msgService = (MessageService)getDestination().getService();

--- In flexcoders@yahoogroups.com, "Tom Bray" <[EMAIL PROTECTED]> wrote:
>
> I've made a little bit of progress on this front.  As suggested by
an Adobe
> engineer, I created a custom ServiceAdapter that overrides invoke()
like so:
> 
> import flex.messaging.messages.CommandMessage;
> import flex.messaging.messages.Message;
> import flex.messaging.services.MessageService;
> import flex.messaging.services.ServiceAdapter;
> 
> public class SimpleCustomAdapter extends ServiceAdapter {
> 
>     @Override
>     public Object invoke(Message message)
>     {
>         MessageService msgService = (MessageService)service;
>         System.out.println( "************" +
message.getBody().toString() );
>         msgService.pushMessageToClients(message, true);
>         return null;
>     }
> 
> Now, the alternate signature for pushMessageToClients accepts a Set of
> clientIDs as the first parameter.  This is what you would use to send a
> message to a specific client.  Now, the next question is how do I
know which
> clients are subscribed to this destination?  I think I need to manage
> subscriptions to the destination so I can keep track of the
clientIDs, but
> the docs are vague about how to do that.
> 
> Here's what my messaging-config.xml looks like:
> 
> ...
>     <adapters>
>        ...
>         <adapter-definition id="custom"
class="test.SimpleCustomAdapter"/>
>         ...
>     </adapters>
> 
>    <destination id="customDest">
> 
>         <adapter ref="custom" />
> 
>     </destination>
> ...
> 
> -Tom
> 
> On 7/21/06, m88e24 <[EMAIL PROTECTED]> wrote:
> >
> >   The selector attribute of the Consumer class allows messages to be
> > filtered based on information in the header of the message. The
> > downside is that a message is always delivered to all clients which is
> > inefficient and is also a potential security hazard.
> >
> > I just want to deliver a message to a single client from a server side
> > Java class.
> >
> > Both methods, routeMessageToService and routeMessageToClient, are
> > missing from the Flex Java API. The routeMessageToService obviously
> > routes messages to all clients connect to the same destination. It
> > maybe very likely that the routeMessageToClient will route the message
> > to a single peer. But the methods needs a MessageClient which is also
> > missing from the Java doc. With some googling I found a Java doc which
> > contains a very terse definition of the MessageClient. But only very
> > terse and of no use to someone who doesn't now the Flex internals.
> >
> > Is there any example or some more verbose documentation on how to use
> > these classes. Much appreciate any help.
> >
> >  
> >
>


Reply via email to