[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] What happened to the "receive" method?



Okay thanks.

I thought the receive method was removed but it turns out to be the other way around.

I'll use the Get() method for now until a new release comes out.

--- Marcel Ruff <mr at marcelruff.info> wrote:

> Michele Laghi wrote:
> > Hi Chris,
> > in fact the method receive is a new method which was not supported
> > before. It is now available but currently still only in the svn sources.
> > The API on the homepage is already basing on these sources. If you are
> > currently using a release please check out the svn.
> >
> > Regards
> > Michele
> >
> > chris lau wrote:
> >   
> >> Hi,
> >>
> >> I was just looking through the Java Client API and tried to use the method "receive" located
> at:
> >> org.xmlBlaster.Client.I_XmlBlasterAccess  ......
> >> ... Can I do this with the Get
> >> method?
> >>     
> Yes, this is the code from XmlBlasterAccess.java which does it with the 
> get() call, it works from any programming language using get().
> In the comments you see the oid to be used like 
> "__cmd:topic/hello/?historyQueueEntries":
> 
> ---------------------------
>    public MsgUnit[] receive(String oid, int maxEntries, long timeout, 
> boolean consumable) throws XmlBlasterException {
>       if (oid == null || oid.length() == 0)
>          throw new XmlBlasterException(glob, 
> ErrorCode.INTERNAL_ILLEGALARGUMENT, ME, "Please supply a valid oid to 
> receive()");
> 
>       ContextNode node = ContextNode.valueOf(oid);
>       if (node.isOfClass(ContextNode.TOPIC_MARKER_TAG))
>          oid = "__cmd:"+oid+"/?historyQueueEntries"; // 
> "__cmd:topic/hello/?historyQueueEntries"
>       else if (node.isOfClass(ContextNode.SUBJECT_MARKER_TAG) && 
> node.getChild(ContextNode.SESSION_MARKER_TAG, null) != null)
>             oid = "__cmd:"+oid+"/?callbackQueueEntries"; // 
> "__cmd:client/joe/session/1/?callbackQueueEntries";
>       else if (node.isOfClass(ContextNode.SUBJECT_MARKER_TAG))
>             oid = "__cmd:"+oid+"/?subjectQueueEntries"; // 
> "__cmd:client/joe/?subjectQueueEntries"
>      
>       GetKey getKey = new GetKey(glob, oid);
>       String qos = "<qos>" +
>                    "<querySpec type='QueueQuery'>" +
>                    
>
"maxEntries="+maxEntries+"&amp;maxSize=-1&amp;consumable="+consumable+"&amp;waitingDelay="+timeout+
>                    "</querySpec>" +
>                    "</qos>";
>       GetQos getQos = new GetQos(glob, 
> glob.getQueryQosFactory().readObject(qos));
>       MsgUnit[] msgs = get(getKey, getQos);
>       if (log.isLoggable(Level.FINEST)) log.finest("Got " + msgs.length 
> + " reply :\n" + ((msgs.length>0)?msgs[0].toXml():""));
>       return msgs;
>    }
> -------------------
> 
> regards
> Marcel
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com