Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package com.ibm.mqlight.api;
 
A set of options that can be used to configure the behaviour of the NonBlockingClient NonBlockingClient#send(String , java.nio.ByteBuffer , Map , SendOptions , CompletionListener , Object ) and NonBlockingClient#send(String , String , Map , SendOptions , CompletionListener , Object ) methods. For example:
 SendOptions opts = SendOptions.builder().setQos(QOS.AT_LEAST_ONCE).setTtl(5000).build();
 client.send("/tadpoles", "Hello baby frogs!", opts, listener, null);
 
 
 public class SendOptions {
 
     private static final Logger logger = LoggerFactory.getLogger(SendOptions.class);
   
     private final QOS qos;
     private final long ttl;
 
     private SendOptions(QOS qoslong ttl) {
         final String methodName = "<init>";
         .entry(thismethodNameqosttl);
       
         this. = qos;
         this. = ttl;
         
         .exit(thismethodName);
     }
 
     public final QOS getQos() {
         return ;
     }
 
     public final long getTtl() {
         return ;
     }
 
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder(super.toString());
         sb.append(" [qos=")
           .append()
           .append(", ttl=")
           .append()
           .append("]");
         return sb.toString();
     }

    

Returns:
a new instance of SendOptionsBuilder that can be used to build (immutable) instances of SendOptions.
 
     public static SendOptionsBuilder builder() {
         return new SendOptionsBuilder();
     }

    
A builder for SendOptions objects.
 
     public static class SendOptionsBuilder {
         private QOS qos = .;
         private long ttl = 0;
 
         private SendOptionsBuilder() {}

        
Sets the quality of service that will be used to send messages to the MQ Light server.

Parameters:
qos The required quality of service. Cannot be null.
Returns:
the instance of SendOptionsBuilder that this method was called on.
Throws:
java.lang.IllegalArgumentException if an invalid qos value is specified.
 
         public SendOptionsBuilder setQos(QOS qosthrows IllegalArgumentException {
             final String methodName = "setQos";
             .entry(thismethodNameqos);
           
             if (qos == null) {
               final IllegalArgumentException exception = new IllegalArgumentException("qos argument cannot be null");
              .throwing(this,  methodNameexception);
              throw exception;
            }
            this. = qos;
            
            .exit(thismethodNamethis);
            
            return this;
        }

        
Sets the time to live that will be used for messages sent to the MQ Light server.

Parameters:
ttl time to live in milliseconds. This must be a positive value, and a maximum of 4294967295 (0xFFFFFFFF)
Returns:
the instance of SendOptionsBuilder that this method was called on.
Throws:
java.lang.IllegalArgumentException if an invalid ttl value is specified.
        public SendOptionsBuilder setTtl(long ttlthrows IllegalArgumentException {
            final String methodName = "setTtl";
            .entry(thismethodNamettl);
          
            if (ttl < 1 || ttl > 4294967295L) {
              final IllegalArgumentException exception = new IllegalArgumentException("ttl value '" + ttl + "' is invalid, must be an unsigned non-zero integer number");
              .throwing(this,  methodNameexception);
              throw exception;
            }
            this. = ttl;
            
            .exit(thismethodNamethis);
            
            return this;
        }

        

Returns:
an instance of SendOptions based on the current settings of this builder.
        public SendOptions build() {
            return new SendOptions();
        }
    }
New to GrepCode? Check out our FAQ X