private void processMetadata() {

    try {

      listRecorMessageToSend =
          outgoingMessageDao.findAll(
              CommunicationNetworkServiceDatabaseConstants.OUTGOING_MESSAGES_STATUS_COLUMN_NAME,
              FermatMessagesStatus.PENDING_TO_SEND.getCode());

      if (listRecorMessageToSend != null && !listRecorMessageToSend.isEmpty()) {

        for (FermatMessage fm : listRecorMessageToSend) {

          if (!poolConnectionsWaitingForResponse.containsKey(fm.getReceiver())) {

            /*
             * Create the sender basic profile
             */
            PlatformComponentProfile sender =
                wsCommunicationsCloudClientManager
                    .getCommunicationsCloudClientConnection()
                    .constructBasicPlatformComponentProfileFactory(
                        fm.getSender(),
                        NetworkServiceType.UNDEFINED,
                        PlatformComponentType.ACTOR_ASSET_REDEEM_POINT);

            /*
             * Create the receiver basic profile
             */
            PlatformComponentProfile receiver =
                wsCommunicationsCloudClientManager
                    .getCommunicationsCloudClientConnection()
                    .constructBasicPlatformComponentProfileFactory(
                        fm.getReceiver(),
                        NetworkServiceType.UNDEFINED,
                        PlatformComponentType.ACTOR_ASSET_ISSUER);

            try {
              communicationNetworkServiceConnectionManager.connectTo(
                  sender, platformComponentProfile, receiver);
            } catch (Exception e) {
              e.printStackTrace();
            }

            // pass the metada to a pool wainting for the response of the other peer or server
            // failure
            poolConnectionsWaitingForResponse.put(fm.getReceiver(), fm);
          }
        }
      }

    } catch (CantReadRecordDataBaseException e) {
      errorManager.reportUnexpectedPluginException(
          Plugins.BITDUBAI_DAP_ASSET_ISSUER_ACTOR_NETWORK_SERVICE,
          UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN,
          new Exception("Can not send Message PENDING_TO_SEND"));
    }
  }
  /**
   * Construct a DatabaseTableRecord whit the values of the a FermatMessage pass by parameter
   *
   * @param incomingTemplateNetworkServiceMessage the contains the values
   * @return DatabaseTableRecord whit the values
   */
  private DatabaseTableRecord constructFrom(FermatMessage incomingTemplateNetworkServiceMessage) {

    /*
     * Create the record to the entity
     */
    DatabaseTableRecord entityRecord = getDatabaseTable().getEmptyRecord();

    /*
     * Set the entity values
     */
    entityRecord.setStringValue(
        CommunicationNetworkServiceDatabaseConstants.INCOMING_MESSAGES_ID_COLUMN_NAME,
        incomingTemplateNetworkServiceMessage.getId().toString());
    entityRecord.setStringValue(
        CommunicationNetworkServiceDatabaseConstants.INCOMING_MESSAGES_SENDER_ID_COLUMN_NAME,
        incomingTemplateNetworkServiceMessage.getSender().toString());
    entityRecord.setStringValue(
        CommunicationNetworkServiceDatabaseConstants.INCOMING_MESSAGES_RECEIVER_ID_COLUMN_NAME,
        incomingTemplateNetworkServiceMessage.getReceiver().toString());
    entityRecord.setStringValue(
        CommunicationNetworkServiceDatabaseConstants.INCOMING_MESSAGES_TEXT_CONTENT_COLUMN_NAME,
        incomingTemplateNetworkServiceMessage.getContent());
    entityRecord.setStringValue(
        CommunicationNetworkServiceDatabaseConstants.INCOMING_MESSAGES_TYPE_COLUMN_NAME,
        incomingTemplateNetworkServiceMessage.getFermatMessageContentType().getCode());

    if (incomingTemplateNetworkServiceMessage.getShippingTimestamp() != null) {
      entityRecord.setLongValue(
          CommunicationNetworkServiceDatabaseConstants
              .OUTGOING_MESSAGES_SHIPPING_TIMESTAMP_COLUMN_NAME,
          incomingTemplateNetworkServiceMessage.getShippingTimestamp().getTime());
    } else {
      entityRecord.setLongValue(
          CommunicationNetworkServiceDatabaseConstants
              .OUTGOING_MESSAGES_SHIPPING_TIMESTAMP_COLUMN_NAME,
          new Long(0));
    }

    if (incomingTemplateNetworkServiceMessage.getDeliveryTimestamp() != null) {
      entityRecord.setLongValue(
          CommunicationNetworkServiceDatabaseConstants
              .INCOMING_MESSAGES_SHIPPING_TIMESTAMP_COLUMN_NAME,
          incomingTemplateNetworkServiceMessage.getDeliveryTimestamp().getTime());
    } else {
      entityRecord.setLongValue(
          CommunicationNetworkServiceDatabaseConstants
              .INCOMING_MESSAGES_DELIVERY_TIMESTAMP_COLUMN_NAME,
          new Long(0));
    }

    entityRecord.setStringValue(
        CommunicationNetworkServiceDatabaseConstants.INCOMING_MESSAGES_STATUS_COLUMN_NAME,
        incomingTemplateNetworkServiceMessage.getFermatMessagesStatus().getCode());

    /*
     * return the new table record
     */
    return entityRecord;
  }
  /**
   * (non-javadoc)
   *
   * @see FermatMessageProcessor#processingMessage(FermatMessage, JsonObject)
   */
  @Override
  public void processingMessage(FermatMessage fermatMessage, JsonObject jsonMsjContent) {

    try {

      /*
       * Get the XML representation of the Digital Asset Metadata
       */
      String digitalAssetMetadataXml =
          jsonMsjContent.get(AssetTransmissionJsonAttNames.DIGITAL_ASSET_METADATA).getAsString();
      PlatformComponentType senderType =
          gson.fromJson(
              jsonMsjContent.get(AssetTransmissionJsonAttNames.SENDER_TYPE).getAsString(),
              PlatformComponentType.class);
      PlatformComponentType receiverType =
          gson.fromJson(
              jsonMsjContent.get(AssetTransmissionJsonAttNames.RECEIVER_TYPE).getAsString(),
              PlatformComponentType.class);

      /*
       * Convert the xml to object
       */
      DigitalAssetMetadata digitalAssetMetadata =
          (DigitalAssetMetadata)
              XMLParser.parseXML(digitalAssetMetadataXml, new DigitalAssetMetadata());

      /*
       * Construct a new digitalAssetMetadataTransaction
       */
      DigitalAssetMetadataTransactionImpl digitalAssetMetadataTransaction =
          new DigitalAssetMetadataTransactionImpl();
      digitalAssetMetadataTransaction.setGenesisTransaction(
          digitalAssetMetadata.getGenesisTransaction());
      digitalAssetMetadataTransaction.setSenderId(fermatMessage.getSender());
      digitalAssetMetadataTransaction.setSenderType(senderType);
      digitalAssetMetadataTransaction.setReceiverId(fermatMessage.getReceiver());
      digitalAssetMetadataTransaction.setReceiverType(receiverType);
      digitalAssetMetadataTransaction.setDigitalAssetMetadata(digitalAssetMetadata);
      digitalAssetMetadataTransaction.setDistributionStatus(DistributionStatus.ASSET_DISTRIBUTED);
      digitalAssetMetadataTransaction.setType(
          DigitalAssetMetadataTransactionType.META_DATA_TRANSMIT);
      digitalAssetMetadataTransaction.setProcessed(
          DigitalAssetMetadataTransactionImpl.NO_PROCESSED);

      /*
       * Save into data base for audit control
       */
      getAssetTransmissionNetworkServicePluginRoot()
          .getDigitalAssetMetaDataTransactionDao()
          .create(digitalAssetMetadataTransaction);

      /*
       * Mark the message as read
       */
      ((FermatMessageCommunication) fermatMessage)
          .setFermatMessagesStatus(FermatMessagesStatus.READ);
      ((CommunicationNetworkServiceConnectionManager)
              getAssetTransmissionNetworkServicePluginRoot().getNetworkServiceConnectionManager())
          .getIncomingMessageDao()
          .update(fermatMessage);

      /*
       * Notify to the interested
       */
      FermatEvent event =
          getAssetTransmissionNetworkServicePluginRoot()
              .getEventManager()
              .getNewEvent(EventType.RECEIVED_NEW_DIGITAL_ASSET_METADATA_NOTIFICATION);
      event.setSource(AssetTransmissionNetworkServicePluginRoot.EVENT_SOURCE);
      getAssetTransmissionNetworkServicePluginRoot().getEventManager().raiseEvent(event);

    } catch (Exception e) {
      getAssetTransmissionNetworkServicePluginRoot()
          .getErrorManager()
          .reportUnexpectedPluginException(
              Plugins.BITDUBAI_DAP_ASSET_TRANSMISSION_NETWORK_SERVICE,
              UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN,
              e);
    }
  }