Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [leshan-dev] How activate Queue mode?

Hello Jacopo,

 

Perhaps little bit my mistake.

The org.eclipse.leshan.server.californium.impl.LeshanServer does not support the implemented QueuedRequestSender out of the box.

So you have to implement your own LeshanServer with a QueuedRequestSender in it.

OR -  the easiest way to do this, is to patch the already implemented LeshanServer in leshan-server-cf.

To Do so, change the CaliforniumLwM2mRequestSender to LwM2mRequestSenderImpl with both senders.

 

You can put this snippet at end of constructor of org.eclipse.leshan.server.californium.impl.LeshanServer

 

final CaliforniumLwM2mRequestSender californiumSender = new CaliforniumLwM2mRequestSender(endpoints,

                this.observationRegistry, modelProvider, encoder, decoder);

 

        final CaliforniumLwM2mRequestSender anotherCaliforniumSender = new CaliforniumLwM2mRequestSender(

                new HashSet<>(endpoints), observationRegistry, modelProvider, encoder, decoder);

 

        final MessageStore messageStore = new InMemoryMessageStore();

        final QueuedRequestSender queuedRequestSender = QueuedRequestSender.builder().setClientRegistry(clientRegistry)

                .setObservationRegistry(observationRegistry)

                // InMemory message store is still used and not a persistent

                // one.

                .setMessageStore(messageStore).setRequestSender(anotherCaliforniumSender).build();

 

        requestSender = new LwM2mRequestSenderImpl(californiumSender, queuedRequestSender);

 

So your LeshanServer is now able to use the QueuedRequestSender if you client registers with UQ. Mode.

 

BUT NOW your implementation of the  LwM2mServer has to send request asynasynchronously.

If you use the LeshanServerDemo for testing, you have to change this in the ClientServlet.

In the doGet() method you have to call the asynchronously method  

 

send(Client destination, DownlinkRequest<T> request, ResponseCallback<T> responseCallback, ErrorCallback errorCallback)

  

instead of

 

server.send(client, request, TIMEOUT) from the LwM2mRequestSenderImpl

 

and then handle the callback.

 

have fun....

If you have any further questions please ask J

 

Ingo

 

 

 

Von: leshan-dev-bounces@xxxxxxxxxxx [mailto:leshan-dev-bounces@xxxxxxxxxxx] Im Auftrag von Jacopo Piani
Gesendet: Mittwoch, 16. November 2016 08:51
An: leshan developer discussions <leshan-dev@xxxxxxxxxxx>
Betreff: [leshan-dev] How activate Queue mode?

 

Hello,
someone can tell me how to activate the Queue mode using the Leshan server?

I have written other times but with the answers I have received I have not been able to solve my problem; I realized that the Queue mode currently implemented on Leshan is an experimental version, not stable and whose specifications are different from the Queue mode specified by LWM2M Protocol.
However, is not enough to set the binding mode equal to "UQ", as well as doing so the node is registered in Queue mode but Leshan does not queue any packets when the node goes to sleep. If I look at the window at the bottom of Leshan server web page (COAP messages), I do not see that the server appends any messages, nor transmit them to the node when the it wakes up.

What else should I do, to make sure that the server queues the requests?

Thks
Jacopo


Back to the top