Package org.fudgemsg

Examples of org.fudgemsg.FudgeMsg


  // REVIEW kirk 2009-10-28 -- This is just a braindead way of getting ticks to come in
  // until we can get a handle on the construction of receivers based on responses.
  @Override
  public void messageReceived(FudgeContext fudgeContext,
      FudgeMsgEnvelope msgEnvelope) {
    FudgeMsg fudgeMsg = msgEnvelope.getMessage();
    LiveDataValueUpdateBean update = LiveDataValueUpdateBeanFudgeBuilder.fromFudgeMsg(new FudgeDeserializer(fudgeContext), fudgeMsg);
    valueUpdate(update);
  }
View Full Code Here


      try {
       
        if ((envelope == null) || (envelope.getMessage() == null)) {
          throw new OpenGammaRuntimeException("Got a message that can't be deserialized from a Fudge message.");
        }
        FudgeMsg msg = envelope.getMessage();
       
        LiveDataSubscriptionResponseMsg responseMessage = LiveDataSubscriptionResponseMsg.fromFudgeMsg(new FudgeDeserializer(getFudgeContext()), msg);
        if (responseMessage.getResponses().isEmpty()) {
          throw new OpenGammaRuntimeException("Got empty subscription response " + responseMessage);
        }
View Full Code Here

    clean();
    FudgeSerializer serializer = new FudgeSerializer(OpenGammaFudgeContext.getInstance());
    FudgeDeserializer deserializer = new FudgeDeserializer(OpenGammaFudgeContext.getInstance());
    List<DBObject> objects = new ArrayList<DBObject>();
    for (PersistentSubscription sub : newState) {
      FudgeMsg msg = LiveDataSpecificationFudgeBuilder.toFudgeMsg(serializer, sub.getFullyQualifiedSpec());
      DBObject fieldData = deserializer.fudgeMsgToObject(DBObject.class, msg);
      BasicDBObject mainObject = new BasicDBObject();
      mainObject.append("fieldData", fieldData);
      objects.add(mainObject);
    }
View Full Code Here

  //-------------------------------------------------------------------------
  @Override
  @Transactional
  public FudgeMsg requestReceived(FudgeDeserializer deserializer, FudgeMsgEnvelope requestEnvelope) {
    try {
      FudgeMsg requestFudgeMsg = requestEnvelope.getMessage();
      LiveDataSubscriptionRequest subscriptionRequest = LiveDataSubscriptionRequest.fromFudgeMsg(deserializer, requestFudgeMsg);
      s_logger.debug("Received subscription request {}", subscriptionRequest);
      LiveDataSubscriptionResponseMsg subscriptionResponse = getLiveDataServer().subscriptionRequestMade(subscriptionRequest);
      s_logger.debug("Sending subscription response {}", subscriptionResponse);
      FudgeMsg responseFudgeMsg = subscriptionResponse.toFudgeMsg(new FudgeSerializer(deserializer.getFudgeContext()));
      return responseFudgeMsg;
    } catch (RuntimeException e) {
      s_logger.error("Unexpected exception when processing subscription request", e);
      throw e;     
    }
View Full Code Here

   * @param history  the history of field values 
   * @return the normalized message, null if in the process of normalization,
   *  the message became empty and therefore should not be sent.
   */
  public FudgeMsg getNormalizedMessage(FudgeMsg msg, String securityUniqueId, FieldHistoryStore history) {
    FudgeMsg normalizedMsg = _normalizationRuleSet.getNormalizedMessage(msg, securityUniqueId, history);
    if (normalizedMsg == null) {
      return null;
    }
    if (normalizedMsg.getNumFields() == 0) {
      return null;
    }
    return normalizedMsg;
  }
View Full Code Here

  // LiveDataHeartbeat

  @Override
  public Collection<LiveDataSpecification> heartbeat(final Collection<LiveDataSpecification> activeSubscriptions) {
    Heartbeat heartbeat = new Heartbeat(activeSubscriptions);
    FudgeMsg heartbeatMsg = heartbeat.toFudgeMsg(new FudgeSerializer(getMessageSender().getFudgeContext()));
    getMessageSender().send(heartbeatMsg);
    return null;
  }
View Full Code Here

        fmw.writeMessage (messages[i], 0);
//        System.out.println(messages[i]);
//        System.out.println(sw.toString());
        final StringReader sr = new StringReader(sw.toString());
        final FudgeMsgJSONReader fmr = new FudgeMsgJSONReader(_fudgeContext, sr);
        FudgeMsg message = fmr.readMessage();
        AssertJUnit.assertNotNull(message);
//        System.out.println (message);
        FudgeUtils.assertAllFieldsMatch(messages[i], message, false);
      }
    }
View Full Code Here

    s_logger.debug("Need to actually snapshot {}", snapshotsToActuallyDo);
    Map<String, FudgeMsg> snapshots = doSnapshot(snapshotsToActuallyDo);
    for (Map.Entry<String, FudgeMsg> snapshotEntry : snapshots.entrySet()) {
      String securityUniqueId = snapshotEntry.getKey();
      FudgeMsg msg = snapshotEntry.getValue();

      LiveDataSpecification liveDataSpecFromClient = securityUniqueId2LiveDataSpecificationFromClient.get(securityUniqueId);

      DistributionSpecification distributionSpec = resolved.get(liveDataSpecFromClient);
      FudgeMsg normalizedMsg = distributionSpec.getNormalizedMessage(msg, securityUniqueId);
      if (normalizedMsg == null) {
        String errorMsg = "When snapshot for " + securityUniqueId + " was run through normalization, the message disappeared. " +
            " This indicates there are buggy normalization rules in place, or that buggy (or unexpected) data was" +
            " received from the underlying market data API. Check your normalization rules. Raw, unnormalized msg = " + msg;
        responses.add(buildErrorMessageResponse(liveDataSpecFromClient, LiveDataSubscriptionResult.INTERNAL_ERROR, errorMsg));
View Full Code Here

   * @param securityUniqueId Security unique ID
   * @return The snapshot
   */
  public FudgeMsg doSnapshot(String securityUniqueId) {
    Map<String, FudgeMsg> snapshots = doSnapshot(Collections.singleton(securityUniqueId));
    FudgeMsg snapshot = snapshots.get(securityUniqueId);
    if (snapshot == null) {
      throw new OpenGammaRuntimeException("doSnapshot() did not fulfill its contract to populate map for each unique ID");
    }
    return snapshot;
  }
View Full Code Here

  }

  @Override
  public void messageReceived(FudgeContext fudgeContext, FudgeMsgEnvelope msgEnvelope) {
    s_logger.info("Got message {}", msgEnvelope);
    FudgeMsg msg = msgEnvelope.getMessage();
    CogdaMessageType msgType = CogdaMessageType.getFromMessage(msg);
    switch (msgType) {
      case SUBSCRIPTION_RESPONSE:
      case SNAPSHOT_RESPONSE:
        dispatchCommandResponse(msgType, msg);
View Full Code Here

TOP

Related Classes of org.fudgemsg.FudgeMsg

Copyright © 2018 www.massapicom. 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.