Examples of FudgeMsgEnvelope


Examples of org.fudgemsg.FudgeMsgEnvelope

   * Reads the next message, returning the envelope.
   *
   * @return the {@link FudgeMsgEnvelope}
   */
  public FudgeMsgEnvelope readMessageEnvelope() {
    FudgeMsgEnvelope msgEnv = null;
    try {
      final JSONObject meta = (JSONObject) _jsonObject.get("meta");
      final JSONObject data = (JSONObject) _jsonObject.get("data");
      final MutableFudgeMsg msg = processFields(data, meta);
      msgEnv = getFudgeMsgEnvelope(msg, _jsonObject);
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

    }
    return msgEnv;
  }

  private FudgeMsgEnvelope getFudgeMsgEnvelope(final MutableFudgeMsg fudgeMsg, final JSONObject jsonObject) throws JSONException {
    return new FudgeMsgEnvelope(fudgeMsg, _schemaVersion, _processingDirectives);
  }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

    final ValueSpecification valueSpecification = new ValueSpecification(CREDIT_SENSITIVITIES_REQUIREMENT, target.toSpecification(), createCurrencyValueProperties(target).get());
    return Collections.singleton(new ComputedValue(valueSpecification, labelledMatrix));
  }

  private List<FactorExposureData> decodeSensitivities(final SecuritySource secSource, final RawSecurity rawSecurity) {
    final FudgeMsgEnvelope msg = OpenGammaFudgeContext.getInstance().deserialize(rawSecurity.getRawData());
    final SecurityEntryData securityEntryData = OpenGammaFudgeContext.getInstance().fromFudgeMsg(SecurityEntryData.class, msg.getMessage());
    final RawSecurity underlyingRawSecurity = (RawSecurity) secSource.getSingle(securityEntryData.getFactorSetId().toBundle());
    if (underlyingRawSecurity != null) {
      final FudgeMsgEnvelope factorIdMsg = OpenGammaFudgeContext.getInstance().deserialize(underlyingRawSecurity.getRawData());
      @SuppressWarnings("unchecked")
      final
      List<FactorExposureData> factorExposureDataList = OpenGammaFudgeContext.getInstance().fromFudgeMsg(List.class, factorIdMsg.getMessage());
      return factorExposureDataList;
    } else {
      throw new OpenGammaRuntimeException("Couldn't find factor list security " + securityEntryData.getFactorSetId());
    }
  }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

    final ValueSpecification valueSpecification = new ValueSpecification(EXTERNAL_SENSITIVITIES_REQUIREMENT, target.toSpecification(), createCurrencyValueProperties(target).get());
    return Collections.singleton(new ComputedValue(valueSpecification, labelledMatrix));
  }

  private List<FactorExposureData> decodeSensitivities(final SecuritySource secSource, final RawSecurity rawSecurity) {
    final FudgeMsgEnvelope msg = OpenGammaFudgeContext.getInstance().deserialize(rawSecurity.getRawData());
    final SecurityEntryData securityEntryData = OpenGammaFudgeContext.getInstance().fromFudgeMsg(SecurityEntryData.class, msg.getMessage());
    final RawSecurity underlyingRawSecurity = (RawSecurity) secSource.getSingle(securityEntryData.getFactorSetId().toBundle());
    if (underlyingRawSecurity != null) {
      final FudgeMsgEnvelope factorIdMsg = OpenGammaFudgeContext.getInstance().deserialize(underlyingRawSecurity.getRawData());
      @SuppressWarnings("unchecked")
      final
      List<FactorExposureData> factorExposureDataList = OpenGammaFudgeContext.getInstance().fromFudgeMsg(List.class, factorIdMsg.getMessage());
      return factorExposureDataList;
    } else {
      throw new OpenGammaRuntimeException("Couldn't find factor list security " + securityEntryData.getFactorSetId());
    }
  }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

   */
  @Override
  public void messagesReceived(List<byte[]> messages) {
    List<FudgeMsgEnvelope> fudgeMessages = new ArrayList<FudgeMsgEnvelope>(messages.size());
    for (byte[] bytes : messages) {
      FudgeMsgEnvelope msgEnvelope = getFudgeContext().deserialize(bytes);
      fudgeMessages.add(msgEnvelope);
    }
    getUnderlying().messagesReceived(getFudgeContext(), fudgeMessages);
  }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

    return _securitySource;
  }

  @Override
  public byte[] requestReceived(byte[] message) {
    FudgeMsgEnvelope requestEnvelope = _fudgeContext.deserialize(message);
    FudgeMsg requestFudgeMsg = requestEnvelope.getMessage();
    SecurityMasterRequestMessage secMasterRequest = SecurityMasterRequestMessage.fromFudgeMsg(new FudgeDeserializer(_fudgeContext), requestFudgeMsg);
    MessageType messageType = secMasterRequest.getMessageType();
    String secDes = secMasterRequest.getUniqueId() != null ? secMasterRequest.getUniqueId().getValue() : secMasterRequest.getSecKey().toString();
    s_logger.debug("Received {} request for {} ", new Object[] {secMasterRequest.getMessageType(), secDes });
    Security sec = null;
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

   * Receives the byte array message and processes it using the underlying Fudge receiver.
   * @param message  the byte array message, not null
   */
  @Override
  public void messageReceived(byte[] message) {
    FudgeMsgEnvelope msgEnvelope = getFudgeContext().deserialize(message);
    s_logger.debug("Msg of size {} had {} fields", message.length, msgEnvelope.getMessage().getNumFields());
    getUnderlying().messageReceived(getFudgeContext(), msgEnvelope);
  }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

    client.setPortNumber(server.getPortNumber());
    // connect and send testMessage1, then verify that testMessage2 was sent back
    final CollectingFudgeMessageReceiver clientReceiver = new CollectingFudgeMessageReceiver();
    client.setFudgeMessageReceiver(clientReceiver);
    client.getFudgeMessageSender().send(testMessage1);
    final FudgeMsgEnvelope envelope = clientReceiver.waitForMessage(Timeout.standardTimeoutMillis());
    assertNotNull(envelope);
    assertEquals(testMessage2, envelope.getMessage());
    client.stop();
    server.stop();
  }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

    client.getFudgeMessageSender().send(testMessage1);
    assertTrue(message3Receiver.getMessages().isEmpty());
    client.getFudgeMessageSender().send(testMessage2);
    assertTrue(message3Receiver.getMessages().isEmpty());
    client.getFudgeMessageSender().send(testMessage3);
    final FudgeMsgEnvelope envelope = message3Receiver.waitForMessage(Timeout.standardTimeoutMillis());
    assertNotNull(envelope);
    assertEquals(testMessage3, envelope.getMessage());
    server.stop();
    client.stop();
  }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

    client.getFudgeMessageSender().send(FudgeContext.EMPTY_MESSAGE);
    client.getFudgeMessageSender().send(FudgeContext.EMPTY_MESSAGE);
    client.getFudgeMessageSender().send(FudgeContext.EMPTY_MESSAGE);
    final int[] result = new int[4];
    for (int i = 0; i < 4; i++) {
      final FudgeMsgEnvelope envelope = responses.waitForMessage(Timeout.standardTimeoutMillis() * 2L);
      assertNotNull (envelope);
      result[i] = envelope.getMessage().getInt("foo");
    }
    return result;
  }
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.