Open topic with navigation

# Structuring Programs in Go

Application programs in the Go language differ in several ways from programs in other languages. These steps outline the main structural components of most Go application programs that communicate using TIBCO FTL.

## Summary of Differences

- Go does not support FTL timer events.
- Queue objects do not require explicit dispatch.
- Subscribe calls are methods of event queue objects, and these methods automatically add the new subscriber objects to the queue.
- When an inbound message arrives, the queue places the message on a subscriber channel, where your message processing methods can receive it.
- FTL inline mode is not relevant to Go programs.

Procedure
Task A Initializing TIBCO FTL Objects
1. Create a realm object by connecting to an FTL server.
Task B Processing Events
2. Create channels for inbound messages, and define goroutines to process messages from those channels.
3. Create channels for advisory messages, and define goroutines to process advisories, as needed.
4. Create a channel for out-of-band notifications, and define a goroutine to process notifications.
5. Launch the goroutines that poll message channels.
Task C Sending Messages
6. Define structs for marshaling data to and from messages.
7. Define methods to construct outbound messages.
8. Instantiate endpoints as publisher objects.
9. Arrange to call the send methods of publishers.

   Programs usually call send methods in the context of a data-generation loop, or during message processing, or both.

Task D Receiving Messages
10. Create an event queue object.
11. Create subscriber objects.
    Supply a channel as an argument. (The goroutines that process messages on the channel are already running.)
    With a durable, supply a name property.
Task E Recovery and Clean-Up
12. Recover from administrative disable (see Recovery of a Disabled Process Restart versus Reopen the Realm).
13. Exit cleanly (see Clean-Up).

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO FTL® - Enterprise Edition

Copyright © 2009-2024. Cloud Software Group, Inc. All Rights Reserved.