Announcement

Collapse
No announcement yet.

getReceivedDate() problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • getReceivedDate() problem

    I have a problem retrieving the date a message was received at source from some code I am writing in a javascript response transformer.

    I can use
    Code:
    connectorMessage.getReceivedDate()
    , but this is the date that the message was picked by the destination, so I tried
    Code:
    message.getConnectorMessages().get(0).getReceivedDate()
    but this throws and error.

    Is this possible to do in the response transformer or do I need to get it earlier in the source transformer and save in the channelMap?

    Simon

  • #2
    The "message" ImmutableMessage object is only available in the postprocessor. If you need to access something specific to a connector in a different connector's transformer, then yeah you'll have to store such information in the channel map.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      Nick, thank you for your prompt reply. If I were to save connectorMessage.getReceivedDate() in the channel Map would I be able to access it again as a calendar object? I mean, is it serializable so persists in the database should the message be reprocessed?

      Comment


      • #4
        Originally posted by seaston View Post
        Nick, thank you for your prompt reply. If I were to save connectorMessage.getReceivedDate() in the channel Map would I be able to access it again as a calendar object? I mean, is it serializable so persists in the database should the message be reprocessed?
        That's right. It's serializable, so you'll still be able to access it as a Calendar object even if it gets persisted and later retrieved from the database.
        Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

        Nicholas Rupley
        Work: 949-237-6069
        Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


        - How do I foo?
        - You just bar.

        Comment


        • #5
          It's working perfectly now thanks, however I realized that I had to use a javascript step and not a mapper step to save the date as the mapper step appears to convert to a string.

          Comment


          • #6
            Keep the Orig.ReceiveDate of message PROBLEM

            Sorry but i don't understand very well.

            How can i use the origine receive date of message?

            The Postprocessor is at the end of flow message and the dates are not visible before from mapping.

            Anyway ImmutablMessage.getReceiveDate() is also Deprecated!!
            Is there an alternative way?

            Thanks


            PS i work with mirthconnect 3.2.2.7694
            Last edited by gazzerpiece; 10-22-2015, 05:57 AM. Reason: update mirth version

            Comment


            • #7
              Put this in the source transformer then you can use it later...

              Code:
              channelMap.put("ReceivedDate",connectorMessage.getReceivedDate());

              Comment

              Working...
              X