           segments)
         segments))))
 
+(defn get-peer-link-pub [peer-link k]
+  (if-let [pub @(get-in peer-link [k :pub])]
+    pub
+    (reset! (get-in peer-link [k :pub]) ((get-in peer-link [k :f-create])))))
+
 (defmethod extensions/send-messages AeronConnection
   [messenger event peer-link batch]
   (let [[len unsafe-buffer] (protocol/build-messages-msg-buf (:compress-f messenger) batch)
-        pub ^uk.co.real_logic.aeron.Publication (:send-pub peer-link)
+        pub ^uk.co.real_logic.aeron.Publication (get-peer-link-pub peer-link :send-pub)
         offer-f (fn [] (.offer pub unsafe-buffer 0 len))]
     (while (not (offer-f))
       (.idle ^IdleStrategy (:send-idle-strategy messenger) 0))))

(defmethod extensions/internal-retry-message AeronConnection
  [messenger event id peer-link]
  (let [unsafe-buffer (protocol/build-retry-msg-buf id)
        pub ^uk.co.real_logic.aeron.Publication (:aux-pub peer-link)
        offer-f (fn [] (.offer pub unsafe-buffer 0 protocol/retry-msg-length))]
    (while (not (offer-f))
      (.idle ^IdleStrategy (:send-idle-strategy messenger) 0))))

(defmethod extensions/close-peer-connection AeronConnection
  [messenger event peer-link]
  (.close (:send-pub peer-link))
  (.close (:aux-pub peer-link))
  (.close (:conn peer-link)) 
  {})

(defmethod extensions/internal-ack-message AeronConnection
  [messenger event peer-link message-id completion-id ack-val]
  (let [unsafe-buffer (protocol/build-acker-message message-id completion-id ack-val)
        pub ^uk.co.real_logic.aeron.Publication (get-peer-link-pub peer-link :aux-pub)
        offer-f (fn [] (.offer pub unsafe-buffer 0 protocol/ack-msg-length))]
    (while (not (offer-f))
      (.idle ^IdleStrategy (:send-idle-strategy messenger) 0))))
