Examples of BasicProperties


Examples of com.rabbitmq.client.AMQP.BasicProperties

        int previousSent = 0;
        long previousReportTime = startTime;

        long nextSummaryTime = startTime + SUMMARY_EVERY_MS;
        byte[] message = new byte[256];
        BasicProperties props = shouldPersist() ?
                MessageProperties.MINIMAL_PERSISTENT_BASIC :
                    MessageProperties.MINIMAL_BASIC;
        for (int i = 0; i < _messageCount; i++) {
            ByteArrayOutputStream acc = new ByteArrayOutputStream();
            DataOutputStream d = new DataOutputStream(acc);
View Full Code Here

Examples of com.rabbitmq.client.AMQP.BasicProperties

    {
        if (nextPublishSeqNo > 0) {
            unconfirmedSet.add(getNextPublishSeqNo());
            nextPublishSeqNo++;
        }
        BasicProperties useProps = props;
        if (props == null) {
            useProps = MessageProperties.MINIMAL_BASIC;
        }
        transmit(new AMQCommand(new Basic.Publish.Builder()
                                    .exchange(exchange)
View Full Code Here

Examples of com.rabbitmq.client.AMQP.BasicProperties

            Basic.GetOk getOk = (Basic.GetOk)method;
            Envelope envelope = new Envelope(getOk.getDeliveryTag(),
                                             getOk.getRedelivered(),
                                             getOk.getExchange(),
                                             getOk.getRoutingKey());
            BasicProperties props = (BasicProperties)replyCommand.getContentHeader();
            byte[] body = replyCommand.getContentBody();
            int messageCount = getOk.getMessageCount();
            return new GetResponse(envelope, props, body, messageCount);
        } else if (method instanceof Basic.GetEmpty) {
            return null;
View Full Code Here

Examples of com.rabbitmq.client.AMQP.BasicProperties

    i.close();

    Map<String, Object> headers = new HashMap<String, Object>();
    headers.put("filename", filename);
    headers.put("length", (int) f.length());
    BasicProperties props = new BasicProperties.Builder().headers(headers).build();
    ch.basicPublish(exchange, routingKey, props, body);
    System.out.println(" done.");
      }

      conn.close();
View Full Code Here

Examples of com.rabbitmq.client.AMQP.BasicProperties

    public void testDeadLetterPerMessageTTLRemoved() throws Exception {
        declareQueue(TEST_QUEUE_NAME, DLX, null, null, 1);
        channel.queueBind(TEST_QUEUE_NAME, "amq.direct", "test");
        channel.queueBind(DLQ, DLX, "test");

        final BasicProperties props = MessageProperties.BASIC.builder().expiration("100").build();
        publish(props, "test message");

        // The message's expiration property should have been removed, thus
        // after 100ms of hitting the queue, the message should get routed to
        // the DLQ *AND* should remain there, not getting removed after a subsequent
View Full Code Here

Examples of com.rabbitmq.client.AMQP.BasicProperties

    @Override
    protected ProcessResult innerProcessResult(CrawlURI curi)
            throws InterruptedException {
        byte[] message = null;
        BasicProperties props = null;

        message = buildMessage(curi);
        props = amqpMessageProperties();
        try {
            amqpProducer().publishMessage(message, props);
View Full Code Here

Examples of com.rabbitmq.client.AMQP.BasicProperties

        channel.exchangeDeclare(TEST_EXCHANGE, "topic");
        brokerSetup.declareAndBindQueue(TEST_QUEUE, TEST_EXCHANGE, routingKey);
        channel.queueDeclarePassive(TEST_QUEUE);
       
        String body = "test.body";
        channel.basicPublish(TEST_EXCHANGE, routingKey, new BasicProperties(), body.getBytes());
       
        GetResponse response = channel.basicGet(TEST_QUEUE, true);
        Assert.assertNotNull("no message in queue", response);
        Assert.assertEquals("wrong message in queue", new String(response.getBody(), "UTF-8"), body);
       
View Full Code Here

Examples of com.rabbitmq.client.AMQP.BasicProperties

     * otherwise.
     *
     * @return The message body's charset encoding
     */
    public Charset readCharset() {
        BasicProperties basicProperties = message.getBasicProperties();
        if (basicProperties == null) {
            return Message.DEFAULT_MESSAGE_CHARSET;
        }
        String contentCharset = basicProperties.getContentEncoding();
        if (contentCharset == null) {
            return Message.DEFAULT_MESSAGE_CHARSET;
        }
        return Charset.forName(contentCharset);
    }
View Full Code Here

Examples of com.rabbitmq.client.AMQP.BasicProperties

     * Answers the binary durability BasicProperties according
     * to the brokerChannel's durability.
     * @return BasicProperties
     */
    private BasicProperties binaryDurability() {
        BasicProperties durability = null;
        if (this.brokerChannel().isDurable()) {
            durability = MessageProperties.PERSISTENT_BASIC;
        }
        return durability;
    }
View Full Code Here

Examples of eu.planets_project.tb.api.model.BasicProperties

        if( exp.getCurrentPhase() != null )
            log.debug("Experiment Current Phase Stage is " + exp.getCurrentPhase().getState());

        this.exp = exp;
      ExperimentSetup expsetup = exp.getExperimentSetup();
      BasicProperties props = expsetup.getBasicProperties();
      this.id = exp.getEntityID();
      this.ename =(props.getExperimentName());
      this.escope=(props.getScope());
      this.econsiderations=(props.getConsiderations());
      this.econtactaddress=(props.getContactAddress());
      this.econtactemail=(props.getContactMail());
      this.econtacttel=(props.getContactTel());
      this.econtactname=(props.getContactName());
       
        // references
        this.exid=props.getExternalReferenceID();
       
        List<String[]> lit = props.getAllLiteratureReferences();
        if (lit != null && !lit.isEmpty()) {
            this.litrefdesc = new ArrayList<String>(lit.size());
            this.litrefuri = new ArrayList<String>(lit.size());
            this.litreftitle = new ArrayList<String>(lit.size());
            this.litrefauthor = new ArrayList<String>(lit.size());
            for( int i = 0; i < lit.size(); i++ ) {
            this.litrefdesc.add(i, lit.get(i)[0]);
            this.litrefuri.add(i,lit.get(i)[1]);
            this.litreftitle.add(i,lit.get(i)[2]);
            this.litrefauthor.add(i,lit.get(i)[3]);
            }
        }      
       
        List<Long> refs = props.getExperimentReferences();
        if (refs != null && !refs.isEmpty()) {
            this.eref = new ArrayList<String>(refs.size());
            for( int i = 0; i < refs.size(); i++ )
                this.eref.add(i, ""+refs.get(i) );
        }       
        List<String> involvedUsers = props.getInvolvedUserIds();
        String partpnts = " ";
        for(int i=0;i<involvedUsers.size();i++) {
            partpnts +=involvedUsers.get(i);
            if( i < involvedUsers.size()-1 ) partpnts += ", ";
        }
       

        this.eparticipants = partpnts;
       
        String Test = props.getExternalReferenceID();
       
        this.exid=(Test);
       

        this.efocus=(props.getFocus());

      this.epurpose=(props.getPurpose());
      this.esummary=(props.getSummary());
      this.formality = props.isExperimentFormal();     
     
        //get already added TestbedServiceTemplate data
        log.debug("fill expBean: executable = "+exp.getExperimentExecutable());
        if(exp.getExperimentExecutable()!=null){
          ExperimentExecutable executable = exp.getExperimentExecutable();
          this.selSerTemplate = executable.getServiceTemplate();
          if( selSerTemplate != null )
              this.sSelSerTemplateID = selSerTemplate.getUUID();
          this.sSelSerOperationName = executable.getSelectedServiceOperationName();
          this.bOperationSelectionCompleted = true;
          helperLoadInputData(executable.getInputData());
          if(executable.isExecutionSuccess()){
            //uses the executable to get the data
              this.outputData = exp.getExperimentExecutable().getOutputDataEntries();
          }
        }
    
        //fill the file benchmarks
        log.info("Looking for BMGs... ");
        try {
          if (exp.getCurrentPhase() instanceof ExperimentEvaluation) {
              if (this.inputData != null) {

                  //iterate over all input files
                  for(String localFileRef : this.inputData.values()) {
                      // Clean up the localFileRef, so that the TB can cope with it's data store being moved.
                      //store a set of file BMGoals for every record item
                      DataHandler dh = new DataHandlerImpl();
                      DigitalObjectRefBean dorb = dh.get(localFileRef);
                      if( dorb != null ) {
                          URI inputFileURI = dorb.getDownloadUri();
                          Collection<BenchmarkGoal> colFileBMGoals = exp.getExperimentEvaluation().getEvaluatedFileBenchmarkGoals(inputFileURI);
                          if(colFileBMGoals==null)
                              throw new Exception("Exception while setting file benchmarks for record: "+inputFileURI);

                          for(BenchmarkGoal bmg : colFileBMGoals){
                              log.info("Found fileBMG: " + bmg.getName());
                              log.info("Found fileBMG.id: " + bmg.getID());
                              //now crate the bmb out of the bmg
                              BenchmarkBean bmb = new BenchmarkBean(bmg);
                              bmb.setSourceValue(bmg.getSourceValue());
                              bmb.setTargetValue(bmg.getTargetValue());
                              bmb.setEvaluationValue(bmg.getEvaluationValue());
                              bmb.setWeight(String.valueOf(bmg.getWeight()));
                              bmb.setSelected(true);
                              if((bmb.getSourceValue()==null)||(bmb.getSourceValue().equals("")))
                                  bmb.setSrcError(true);
                              if((bmb.getTargetValue()==null)||(bmb.getTargetValue().equals("")))
                                  bmb.setTarError(true);             

                              //now add the file bmbs for this experimentbean
                              fileBenchmarks.put(inputFileURI+bmb.getID(), bmb);
                          }
                      }
            }
          }
          }
         
          //fill the experiment overall benchmarks
          Collection<BenchmarkGoal> lbmbs;
          if (exp.getCurrentPhase() instanceof ExperimentEvaluation){
            //get the data from the evaluation phase
            lbmbs = exp.getExperimentEvaluation().getEvaluatedExperimentBenchmarkGoals();
                log.info("Found eval #BMGs = " + lbmbs.size());
                log.info("Found pre-eval #BMGs = " + exp.getExperimentSetup().getAllAddedBenchmarkGoals().size());
                // if none, get the data from the setup phase
                if( lbmbs.size() == 0 )
                    lbmbs = exp.getExperimentSetup().getAllAddedBenchmarkGoals();
          }
          else{
            //get the data from the setup phase
            lbmbs = exp.getExperimentSetup().getAllAddedBenchmarkGoals();
                log.info("Found pre-eval #BMGs = " + lbmbs.size());
          }    
        for(BenchmarkGoal bmg : lbmbs){
                log.info("Found BMG: " + bmg.getName());
                log.info("Found BMG.id: " + bmg.getID());
            BenchmarkBean bmb = new BenchmarkBean(bmg);
            bmb.setSourceValue(bmg.getSourceValue());
            bmb.setTargetValue(bmg.getTargetValue());
            bmb.setEvaluationValue(bmg.getEvaluationValue());
            bmb.setWeight(String.valueOf(bmg.getWeight()));
            bmb.setSelected(true);
            experimentBenchmarks.put(bmg.getID(), bmb);
          }
        }catch (Exception e) {
          log.error("Exception during attempt to create ExperimentBean for: "+e.toString());
          if( log.isDebugEnabled() ) e.printStackTrace();
        }
     
       
      String intensity = Integer.toString(exp.getExperimentSetup().getExperimentResources().getIntensity());
      if (intensity != null && intensity != "-1")
        this.intensity = intensity;
      // determine current Stage
      ExperimentPhase currPhaseObj = exp.getCurrentPhase();
      if (currPhaseObj != null) {
        String currPhase = currPhaseObj.getPhaseName();
        if (currPhase.equals(ExperimentPhase.PHASENAME_EXPERIMENTSETUP)) {
          this.currStage = exp.getExperimentSetup().getSubStage();
        } else if (currPhase.equals(ExperimentPhase.PHASENAME_EXPERIMENTAPPROVAL)) {
          this.currStage = ExperimentBean.PHASE_EXPERIMENTAPPROVAL;
        } else if (currPhase.equals(ExperimentPhase.PHASENAME_EXPERIMENTEXECUTION)) {
          this.currStage = ExperimentBean.PHASE_EXPERIMENTEXECUTION;
            } else if (currPhase.equals(ExperimentPhase.PHASENAME_EXPERIMENTEVALUATION)) {
                this.currStage = ExperimentBean.PHASE_EXPERIMENTEVALUATION;
            } else if (currPhase.equals(ExperimentPhase.PHASENAME_EXPERIMENTFINALIZED)) {
                this.currStage = ExperimentBean.PHASE_EXPERIMENTFINALIZED;               
            }
      }
      if(currStage>ExperimentBean.PHASE_EXPERIMENTSETUP_3) {
          approved=true;
      } else {
          approved=false;
      }
       
        this.dtype = props.getDigiTypes();
       
        // Set the report up:
        this.ereportTitle = exp.getExperimentEvaluation().getExperimentReport().getHeader();
        this.ereportBody = exp.getExperimentEvaluation().getExperimentReport().getBodyText();
        this.evaluationData = exp.getExperimentEvaluation().getExternalEvaluationDocuments();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.