@snippet
def topic_publish_messages(client, to_delete):
 TOPIC_NAME = ('topic_publish_messages-%d' % (_millis(),))
 topic = client.topic(TOPIC_NAME)
 topic.create()
 to_delete.append(topic)
 topic.publish('This is the message payload')
 topic.publish('Another message payload', extra='EXTRA')

@ snippet def topic_publish_messages ( client , to_delete ) : TOPIC_NAME = ( 'topic_publish_messages-%d' % ( _millis ( ) , ) ) topic = client . topic ( TOPIC_NAME ) topic . create ( ) to_delete . append ( topic ) topic . publish ( 'This is the message payload' ) topic . publish ( 'Another message payload' , extra = 'EXTRA' )
publish messages to a topic .