Creates a new {@link TopicProducer}. The producer accepts arbitrary objects and uses the Jackson object mapper to convert them into
JSON and sends them as a text message.
8
public TopicProducer<Object> createTopicJsonProducer(final String topic)
    {
        Preconditions.checkState(connectionFactory != null, "connection factory was never injected!");
        return new TopicProducer<Object>(connectionFactory, jmsConfig, topic, producerCallback);
    }
649317
@Override
	public TopicPublisher createPublisher(Topic topic) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        LocalTopicPublisher publisher = new LocalTopicPublisher(this,topic,idProvider.createID());
	        registerProducer(publisher);
	        return publisher;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
242471
@Override
    public MapMessage createMapMessage() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createMapMessage");

        MapMessage mapMessage = null;

        try {
            mapMessage = jmsSession.createMapMessage();
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createMapMessage", new Object[] { mapMessage });
        }

        return mapMessage;

    }
161388
@Override
    public JMSProducer createProducer() {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createProducer");

        JMSProducer jmsProducer = null;
        try {
            // Create messageproducer first, since we reuse most in jmsproducer
            // destination is passed as null because during send,destination is passed
            // jmssession.createproducer() is not used becuase it stores the list of producers
            // which is not required for simplified API's
            MessageProducer msgProducer = jmsSession.instantiateProducer(null);
            jmsProducer = new JmsJMSProducerImpl(msgProducer);
        } catch (JMSException e) {
            // should never have got here because we pass destination as null so there is no chance 
            // that instantiateProducer() will throw any exception

            FFDCFilter.processException(e,
                                        JmsJMSContextImpl.class.toString() + ".createProducer",
                                        "598", this);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createProducer");

        return jmsProducer;

    }
1061136
@Override
    public Topic createTopic(String topicName) throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createTopic", new Object[] { topicName });

        Topic topic = null;

        try {
            topic = jmsSession.createTopic(topicName);
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createTopic", new Object[] { topic });
        }

        return topic;
    }
867507
def create_message(message)
      begin
        @producer.produce(JSON.dump(message), topic: @topic)
      rescue Kafka::BufferOverflow
        Octo.logger.error 'Buffer Overflow. Sleeping for 1s'
        sleep 1
        retry
      end
    end
562751
private ObjectJS jsonMessage(String message, StringifierFactory jsonStringifierFactory) {
		ObjectJS timelineJS = new ObjectJS();
		timelineJS.setSimpleAttribute("message", message, jsonStringifierFactory.getStringifier(String.class));
		return timelineJS;
	}
181282
public <T> Message build(MessageBodyConverter<T> converter) {
        if (StringUtils.isBlank(this.topic)) {
            throw new IllegalArgumentException("Blank topic");
        }
        if (this.body == null && this.payload == null) {
            throw new IllegalArgumentException("Empty payload");
        }
        byte[] payload = this.payload;
        if (payload == null && converter != null) {
            try {
                payload = converter.toByteArray((T) this.body);
            }
            catch (MetaClientException e) {
                throw new IllegalStateException("Convert message body failed.", e);
            }
        }

        if (payload == null) {
            throw new IllegalArgumentException("Empty payload");
        }
        return new Message(this.topic, payload, this.attribute);
    }
704152
def publish(self, topic, obj, reference_message=None):
        
        logging.debug("Publishing topic (%s): \n%s" % (topic, obj))
        e = Event(
            data=obj,
            type=topic,
        )
        if hasattr(obj, "sender"):
            e.sender = obj.sender

        if reference_message:
            original_incoming_event_hash = None
            if hasattr(reference_message, "original_incoming_event_hash"):
                original_incoming_event_hash = reference_message.original_incoming_event_hash
            elif hasattr(reference_message, "source") and hasattr(reference_message.source, "hash"):
                original_incoming_event_hash = reference_message.source.hash
            elif hasattr(reference_message, "source") and hasattr(reference_message.source, "original_incoming_event_hash"):
                original_incoming_event_hash = reference_message.source.original_incoming_event_hash
            elif hasattr(reference_message, "hash"):
                original_incoming_event_hash = reference_message.hash
            if original_incoming_event_hash:
                e.original_incoming_event_hash = original_incoming_event_hash

        return self.publish_to_backend(
            self._localize_topic(topic),
            self.encrypt(e)
        )
1090336
@Override
    public ProducerSession createProducerSession(
                                                 SIDestinationAddress destAddr,
                                                 String discriminator,
                                                 DestinationType destType,
                                                 OrderingContext extendedMessageOrderingContext,
                                                 String alternateUser)
                    throws SIConnectionDroppedException,
                    SIConnectionUnavailableException,
                    SITemporaryDestinationNotFoundException,
                    SIErrorException,
                    SIIncorrectCallException,
                    SIResourceException,
                    SINotPossibleInCurrentConfigurationException
    {
        ProducerSession session =
                        createProducerSession(destAddr,
                                              discriminator,
                                              destType,
                                              extendedMessageOrderingContext,
                                              alternateUser,
                                              false,
                                              false);

        return session;
    }
665783
@SuppressWarnings("WeakerAccess")
    protected JsonGenerator createJsonGenerator(OutputStream destination) throws IOException {
        return new SentryJsonGenerator(jsonFactory.createGenerator(destination));
    }
122494
public TopicConsumer createTopicListener(final String topic, final ConsumerCallback<Message> messageCallback)
    {
        Preconditions.checkState(connectionFactory != null, "connection factory was never injected!");
        return new TopicConsumer(connectionFactory, jmsConfig, topic, messageCallback);
    }
247210
protected final void registerProducer( AbstractMessageProducer producer )
    {
        if (producersMap.put(producer.getId(),producer) != null)
        	throw new IllegalArgumentException("Producer "+producer.getId()+" already exists");
    }
445393
public static void createTopic(Pubsub client, String fullTopicName)
      throws IOException {
    System.out.println("fullTopicName " + fullTopicName);
    try {
        client.projects().topics().get(fullTopicName).execute();
    } catch (GoogleJsonResponseException e) {
      if (e.getStatusCode() == HttpStatusCodes.STATUS_CODE_NOT_FOUND) {
        Topic topic = client.projects().topics()
                .create(fullTopicName, new Topic())
                .execute();
        System.out.printf("Topic %s was created.%n", topic.getName());
      }
    }
  }
552607
private FlinkKafkaProducer<byte[], byte[]> createTransactionalProducer() throws FlinkKafka011Exception {
		String transactionalId = availableTransactionalIds.poll();
		if (transactionalId == null) {
			throw new FlinkKafka011Exception(
				FlinkKafka011ErrorCode.PRODUCERS_POOL_EMPTY,
				"Too many ongoing snapshots. Increase kafka producers pool size or decrease number of concurrent checkpoints.");
		}
		FlinkKafkaProducer<byte[], byte[]> producer = initTransactionalProducer(transactionalId, true);
		producer.initTransactions();
		return producer;
	}
578193
def community_topic_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/community/topics.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
624897
public KafkaMessage sendMessage(ProducerType type, KafkaMessage message) {
        String key = message.key();
        ProducerRecord<String, byte[]> record = StringUtils.isEmpty(key)
                ? new ProducerRecord<>(message.topic(), message.content())
                : new ProducerRecord<>(message.topic(), key, message.content());
        KafkaProducer<String, byte[]> producer = getJavaProducer(type);
        try {
            RecordMetadata metadata = producer.send(record).get();
            KafkaMessage kafkaMessage = new KafkaMessage(message);
            kafkaMessage.partition(metadata.partition());
            kafkaMessage.offset(metadata.offset());
            return kafkaMessage;
        } catch (InterruptedException | ExecutionException e) {
            throw new KafkaException(e);
        }
    }