CrossClj

0.2.3 docs

SourceDocs



RECENT
    VARS
    ->IronMQ-EDN-Endpoint
    ->IronMQ-JSON-Endpoint
    ->IronMQEndpoint
    ichannelendpoint-implementations
    iqueueendpoint-implementations
    ironmq-edn-endpoint
    ironmq-endpoint
    ironmq-json-endpoint
    log-prefix
    map->IronMQ-EDN-Endpoint
    map->IronMQ-JSON-Endpoint
    map->IronMQEndpoint
    poll-sleep-time
    try-handler
    try-to-get-message

    « Index of all namespaces of this project

    Implementation of the IQueueEndpoint protocol for IronMQ.
    
     * IronMQ only supports strings as messages. If your message is not
       a string, it will be coerced into a string with pr-str. It is
       recommended that you use middleware to ensure that all messages
       are stringified as you like before they reach this endpoint.
    
     * Be aware that these functions throw exceptions if the network is
       down, since they cannot communicate with Iron in that case. A
       future version may wrap them in retry logic (or even better, a
       bridge from a local MQ.)
    
     * If a handler function throws an exception, the message is moved
       to the dead letter queue without a retry. Future versions may
       implement retries.
    
     * IronMQ does not have intrinsic dead letter queues.  We simulate a
       limited DLQ here by creating a queue called "DLQ". If a message
       listener function throws an exception, the message that caused
       the exception is placed on the DLQ.
    
     * IronMQ's push mode requires you to expose an HTTP endpoint, with
       associated security annoyances. Future versions may support
       this. For now, we poll the queue every 5 seconds when a message
       handler function is registered. Webhook push may be implemented
       in the future.
    
    Internal Documentation for Developers
    -------------------------------------
    
    
    * :iron-cache stores the threadpool that
       polls IronMQ in the background and executes the listener function
       when messages become available.
    
     TODO: I don't like that the programmer must remember to unregister
           the listener when it is no longer needed, since forgetting
           about one will leak threads with no (easy) way to find a
           reference to them and shut them down. That needs a better
           solution.
    
     TODO: use webhook rather than polling.
    (ironmq-edn-endpoint name transport)
    Constructor for IronMQ EDN-transcoded queue endpoints. Note that
    this does not create anything in the backend; it just wraps the
    Clojure access points to the backend.
    
    Use the IronMQ IMessageTransport instance to create new instances
    rather than calling this directly!
    (ironmq-endpoint name transport)
    Constructor for IronMQ queue endpoints. Note that this does not
    create anything in the backend; it just wraps the Clojure access
    points to the backend.
    
    Use the IronMQ IMessageTransport instance to create new instances
    rather than calling this directly!
    (ironmq-json-endpoint name transport)
    Constructor for IronMQ JSON-transcoded queue endpoints. Note that
    this does not create anything in the backend; it just wraps the
    Clojure access points to the backend.
    
    Use the IronMQ IMessageTransport instance to create new instances
    rather than calling this directly!
    (log-prefix component)
    (try-handler handler-fn message transport)
    Tries to run handler-fn on message. If it throws an exception, logs
    the exception and sends message to the DLQ on transport
    (try-to-get-message queue)
    If a message is available on the given queue, deletes it from the
    queue and returns it. Otherwise, returns nil. Does not block.