About me

Michael L Perry

Improving Enterprises

Principal Consultant

@michaellperry

User login

The Correspondence unpublish feature

Correspondence queues don’t work like your typical queues. A subscriber sees the entire history of facts that were published to the queue. Retrieving a fact does not remove it from the queue.

While this is a good thing for synchronization among multiple parties, it does have one drawback. When you first encounter a queue, you have to suffer through all of history before you get to the facts that you are really interested in.

To eliminate this problem, I added a feature to Correspondence that allows it to unpublish a fact. When the fact is no longer important, it does not appear in the queue. Here’s a demonstration of the feature.


Watch live streaming video from qedcode at livestream.com

To unpublish a fact, simply define a where clause in the publish statement. The where clause needs to use a predicate directly on the published fact.

fact Task {
key:
    publish ListContents listContents
        where not this.isComplete;

query:
    bool isComplete {
        exists TaskComplete c : c.task = this
            where not c.isUndone
    }
}

A Task will only be published to ListContents as long as it is not complete. Once the task is marked completed, it will be unpublished. People subscribing to the list later will not see any of the completed tasks.