Thank you very much for the help. I really appreciate you trying. I don't 
know what is going on, but I need to move on from this.

Dave

On Saturday, June 29, 2013 8:57:31 PM UTC-5, Baishampayan Ghose wrote:
>
> This form, by the way is readable. Not sure why the print-dup 
> extension is not working though... ~BG 
>
> On Sun, Jun 30, 2013 at 7:18 AM, Dave Kincaid 
> <kincai...@gmail.com<javascript:>> 
> wrote: 
> > Hmm. No, it doesn't. This is what I get with pprint by itself: 
> > 
> > :headers {"pluginKey" #<ByteArrayLongString PLUGIN2>} 
> > 
> > with your version I get: 
> > 
> > :headers 
> >    #=(java.util.HashMap. {"pluginKey" 
> > #=(com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString. 
> > "PLUGIN2")}) 
> > 
> > what I think I needs to be able to read it back in is: 
> > 
> > :headers {"pluginKey" "PLUGIN2"} 
> > 
> > On Saturday, June 29, 2013 8:41:16 PM UTC-5, Baishampayan Ghose wrote: 
> >> 
> >> Does this work? 
> >> 
> >> ;; do the defmethod extension as usual and then define spit-messages as 
> >> such 
> >> (defn spit-messages 
> >>   "Write out the messages in the given seq." 
> >>   [messages dest] 
> >>   (binding [*print-dup* true] 
> >>     (pprint 
> >>      (for [[metadata ^bytes payload] messages] 
> >>        {:header metadata :payload (String. payload)}) 
> >>      dest))) 
> >> 
> >> ~BG 
> >> 
> >> On Sun, Jun 30, 2013 at 7:05 AM, Dave Kincaid <kincai...@gmail.com> 
> wrote: 
> >> > Thanks! If that works, it is perfect. However, my first attempt isn't 
> >> > making 
> >> > any difference. Here is what I have: 
> >> > 
> >> > (defmethod print-dup 
> >> > com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString [o w] 
> >> >   (print-ctor o (fn [o w] (print-dup (String. (.getBytes o)) w)) w)) 
> >> > 
> >> > (defn spit-messages 
> >> >   "Write out the messages in the given seq." 
> >> >   [messages dest] 
> >> >   (print-dup 
> >> >    (for [[metadata ^bytes payload] messages] 
> >> >      {:header metadata :payload (String. payload)}) 
> >> >    dest)) 
> >> > 
> >> > but it still prints it out to the file with #<ByteArrayLongString 
> >> > PLUGIN2>. 
> >> > Did I miss something? 
> >> > 
> >> > On Saturday, June 29, 2013 8:14:49 PM UTC-5, Baishampayan Ghose 
> wrote: 
> >> >> 
> >> >> Adding a method to the `print-dup` multimethod that dispatches on 
> >> >> ByteArrayLongString should help. See here for an example - 
> >> >> http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG 
> >> >> 
> >> >> On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid <kincai...@gmail.com> 
> >> >> wrote: 
> >> >> > I'm using pprint to write out a map to a file then trying to read 
> it 
> >> >> > back in 
> >> >> > using clojure.edn/read (I also get the same error using read). 
> Here 
> >> >> > is 
> >> >> > the 
> >> >> > output (it's a map that was created by the Langohr rabbitmq 
> library): 
> >> >> > 
> >> >> > {:header 
> >> >> >   {:timestamp #inst "2058-04-07T17:56:17.000-00:00", 
> >> >> >    :delivery-tag 2, 
> >> >> >    :expiration nil, 
> >> >> >    :correlation-id nil, 
> >> >> >    :delivery-mode 1, 
> >> >> >    :app-id nil, 
> >> >> >    :user-id nil, 
> >> >> >    :redelivery? true, 
> >> >> >    :header {:headers ()}, 
> >> >> >    :content-type nil, 
> >> >> >    :persistent? false, 
> >> >> >    :reply-to nil, 
> >> >> >    :routing-key "pims_data_capture", 
> >> >> >    :headers {"pluginKey" #<ByteArrayLongString PLUGIN2>}, 
> >> >> >    :type nil, 
> >> >> >    :message-id nil, 
> >> >> >    :cluster-id nil, 
> >> >> >    :message-count 3, 
> >> >> >    :exchange "", 
> >> >> >    :content-encoding nil, 
> >> >> >    :priority nil}, 
> >> >> >   :payload 
> >> >> >   "{\"software\":\"CSTONE\",\"entity\":\"\","} 
> >> >> > 
> >> >> > when I try to read it in I get an UnreadableForm exception. I've 
> >> >> > narrowed it 
> >> >> > down to the #<ByteArrayLongString PLUGIN2> element. If I manually 
> >> >> > change 
> >> >> > that to just a regular string I can read it. What is the idiomatic 
> >> >> > way 
> >> >> > to 
> >> >> > handle this noting that there could be a number of different 
> values 
> >> >> > in 
> >> >> > that 
> >> >> > :headers map. 
> >> >> > 
> >> >> > -- 
> >> >> > -- 
> >> >> > You received this message because you are subscribed to the Google 
> >> >> > Groups "Clojure" group. 
> >> >> > To post to this group, send email to clo...@googlegroups.com 
> >> >> > Note that posts from new members are moderated - please be patient 
> >> >> > with 
> >> >> > your 
> >> >> > first post. 
> >> >> > To unsubscribe from this group, send email to 
> >> >> > clojure+u...@googlegroups.com 
> >> >> > For more options, visit this group at 
> >> >> > http://groups.google.com/group/clojure?hl=en 
> >> >> > --- 
> >> >> > You received this message because you are subscribed to the Google 
> >> >> > Groups 
> >> >> > "Clojure" group. 
> >> >> > To unsubscribe from this group and stop receiving emails from it, 
> >> >> > send 
> >> >> > an 
> >> >> > email to clojure+u...@googlegroups.com. 
> >> >> > For more options, visit https://groups.google.com/groups/opt_out. 
> >> >> > 
> >> >> > 
> >> >> 
> >> >> 
> >> >> 
> >> >> -- 
> >> >> Baishampayan Ghose 
> >> >> b.ghose at gmail.com 
> >> > 
> >> > -- 
> >> > -- 
> >> > You received this message because you are subscribed to the Google 
> >> > Groups "Clojure" group. 
> >> > To post to this group, send email to clo...@googlegroups.com 
> >> > Note that posts from new members are moderated - please be patient 
> with 
> >> > your 
> >> > first post. 
> >> > To unsubscribe from this group, send email to 
> >> > clojure+u...@googlegroups.com 
> >> > For more options, visit this group at 
> >> > http://groups.google.com/group/clojure?hl=en 
> >> > --- 
> >> > You received this message because you are subscribed to the Google 
> >> > Groups 
> >> > "Clojure" group. 
> >> > To unsubscribe from this group and stop receiving emails from it, 
> send 
> >> > an 
> >> > email to clojure+u...@googlegroups.com. 
> >> > For more options, visit https://groups.google.com/groups/opt_out. 
> >> > 
> >> > 
> >> 
> >> 
> >> 
> >> -- 
> >> Baishampayan Ghose 
> >> b.ghose at gmail.com 
> > 
> > -- 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@googlegroups.com<javascript:> 
> > Note that posts from new members are moderated - please be patient with 
> your 
> > first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@googlegroups.com <javascript:> 
> > For more options, visit this group at 
> > http://groups.google.com/group/clojure?hl=en 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Clojure" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to clojure+u...@googlegroups.com <javascript:>. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>
>
>
> -- 
> Baishampayan Ghose 
> b.ghose at gmail.com 
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to