Create a producer that writes String keys and values

@param overrideConfig Producer config to override
@return KafkaProducer
4505
public KafkaProducer<String, String> createStringProducer(Properties overrideConfig) {
        return createProducer(new StringSerializer(), new StringSerializer(), overrideConfig);
    }
485706
public Producer createProducer() throws Exception {
        LOG.debug(this.toString());
        ObjectHelper.notNull(this.mode, "mode");
        GpioPin pin = isAlreadyProvisioned();
        if (pin == null) {
            switch (this.mode) {
            case DIGITAL_OUTPUT:
                pin = getOrCreateController().provisionDigitalOutputPin(getPin(), state);
                break;
            case ANALOG_OUTPUT:
                pin = getOrCreateController().provisionAnalogOutputPin(getPin(), value);
                break;
            case PWM_OUTPUT:
                pin = getOrCreateController().provisionPwmOutputPin(getPin(), (int) value);
                break;
            case ANALOG_INPUT: // PinMode.allInput()
            case DIGITAL_INPUT:
                LOG.error("Cannot create Producer with INPUT Mode");
                return null;
            default:
                LOG.error("Cannot create Producer w/o Mode");
                break;
            }
            pin.setMode(this.mode); // Force Mode to avoid NPE
        } else { // enhancement we could manage several pins with one producer
            throw new IllegalArgumentException(
                    "Cannot create twice same output gpio [" + this.gpioId + "] for Producer");
        }

        // shutdownOption(pin);
        return new GPIOProducer(this, pin, action);
    }
598253
public static KeyManagerFactory keyManagerFactory(AbstractConfig config, String key) {
    final String keyManagerFactoryType = config.getString(key);
    try {
      return KeyManagerFactory.getInstance(keyManagerFactoryType);
    } catch (NoSuchAlgorithmException e) {
      ConfigException exception = new ConfigException(
          key,
          keyManagerFactoryType,
          "Unknown Algorithm."
      );
      exception.initCause(e);
      throw exception;
    }
  }
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;

    }
190944
function overrideConfig(config) {
    if (fs.existsSync(config.config)) {
        var content = fs.readFileSync(config.config, {
            encoding: "utf8"
        });
        var configFile = JSON.parse(content);
        for (var key in configFile) {
            if (configFile.hasOwnProperty(key)) {
                config[key] = configFile[key];
            }
        }
    }
    return config;
}
1119526
private ExecutorService _createExecutorService() {
        int producerConnections = Math.max(Integer.valueOf(
            _configuration.getValue(Property.KAFKA_PRODUCER_CONNECTIONS.getName(), Property.KAFKA_PRODUCER_CONNECTIONS.getDefaultValue())), 10);

        return Executors.newFixedThreadPool(producerConnections, new ThreadFactory() {

                AtomicInteger id = new AtomicInteger(0);

                @Override
                public Thread newThread(Runnable r) {
                    return new Thread(r, MessageFormat.format("kafka-producer-worker-{0}", id.getAndIncrement()));
                }
            });
    }
535321
public ConfigProperty<Resourceadapter<T>> getOrCreateConfigProperty()
   {
      List<Node> nodeList = childNode.get("config-property");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ConfigPropertyImpl<Resourceadapter<T>>(this, "config-property", childNode, nodeList.get(0));
      }
      return createConfigProperty();
   }
885278
MultimapWithProtoValuesFluentAssertion<M> usingConfig(FluentEqualityConfig newConfig) {
    Subject.Factory<MultimapWithMessageValuesSubject<K, M>, Multimap<K, M>> factory =
        multimapWithMessageValues(newConfig);
    MultimapWithMessageValuesSubject<K, M> newSubject = check().about(factory).that(actual());
    if (internalCustomName() != null) {
      newSubject = newSubject.named(internalCustomName());
    }
    return new MultimapWithProtoValuesFluentAssertionImpl<>(newSubject);
  }
748448
def _create_producer(self, settings):
        """"""
        try:
            brokers = settings['KAFKA_HOSTS']
            self.logger.debug("Creating new kafka producer using brokers: " +
                               str(brokers))

            return KafkaProducer(bootstrap_servers=brokers,
                                 value_serializer=lambda m: json.dumps(m),
                                 retries=3,
                                 linger_ms=settings['KAFKA_PRODUCER_BATCH_LINGER_MS'],
                                 buffer_memory=settings['KAFKA_PRODUCER_BUFFER_BYTES'])
        except KeyError as e:
            self.logger.error('Missing setting named ' + str(e),
                               {'ex': traceback.format_exc()})
        except:
            self.logger.error("Couldn't initialize kafka producer in plugin.",
                               {'ex': traceback.format_exc()})
            raise
604393
@SuppressWarnings("unchecked")
  @Override
  public <C extends Configuration<K, T>> C getConfiguration(Class<C> clazz) {
    final C c = cache.getConfiguration(clazz);
    if (c instanceof CompleteConfiguration) {
      final CompleteConfiguration<K, T> cc = (CompleteConfiguration<K,T>) c;
      return (C) new CompleteConfiguration<K, T>() {
        @Override
        public Iterable<CacheEntryListenerConfiguration<K, T>> getCacheEntryListenerConfigurations() {
          return cc.getCacheEntryListenerConfigurations();
        }

        @Override
        public boolean isReadThrough() {
          return cc.isReadThrough();
        }

        @Override
        public boolean isWriteThrough() {
          return cc.isWriteThrough();
        }

        @Override
        public boolean isStatisticsEnabled() {
          return cc.isStatisticsEnabled();
        }

        @Override
        public boolean isManagementEnabled() {
          return cc.isManagementEnabled();
        }

        @Override
        public Factory<CacheLoader<K, T>> getCacheLoaderFactory() {
          return cc.getCacheLoaderFactory();
        }

        @Override
        public Factory<CacheWriter<? super K, ? super T>> getCacheWriterFactory() {
          return cc.getCacheWriterFactory();
        }

        @Override
        public Factory<ExpiryPolicy> getExpiryPolicyFactory() {
          return cc.getExpiryPolicyFactory();
        }

        @Override
        public Class<K> getKeyType() {
          return cc.getKeyType();
        }

        @Override
        public Class<T> getValueType() {
          return cc.getValueType();
        }

        @Override
        public boolean isStoreByValue() {
          return true;
        }
      };
    } else if (c instanceof Configuration) {
      return (C) new Configuration<K, T>() {
        @Override
        public Class<K> getKeyType() {
          return c.getKeyType();
        }

        @Override
        public Class<T> getValueType() {
          return c.getValueType();
        }

        @Override
        public boolean isStoreByValue() {
          return true;
        }
      };
    }
    return c;
  }
646499
@Override
  public DataWriter<D> build() throws IOException {

    DataWriter<D> wrapped = writer;
    if (state.contains(ThrottleWriter.WRITER_LIMIT_RATE_LIMIT_KEY)
        && state.contains(ThrottleWriter.WRITER_THROTTLE_TYPE_KEY)) {
      wrapped = new ThrottleWriter<>(wrapped, state);
    }
    if (state.getPropAsBoolean(RetryWriter.RETRY_WRITER_ENABLED, true)) {
      wrapped = new RetryWriter<>(wrapped, state);
    }
    return wrapped;
  }
855294
@VisibleForTesting
	protected <K, V> KafkaProducer<K, V> getKafkaProducer(Properties props) {
		return new KafkaProducer<>(props);
	}
87048
private static Configuration createCfg(TemplateConfig config) {
		if (null == config) {
			config = new TemplateConfig();
		}

		final Configuration cfg = new Configuration(Configuration.VERSION_2_3_28);
		cfg.setLocalizedLookup(false);
		cfg.setDefaultEncoding(config.getCharset().toString());

		switch (config.getResourceMode()) {
		case CLASSPATH:
			cfg.setTemplateLoader(new ClassTemplateLoader(ClassUtil.getClassLoader(), config.getPath()));
			break;
		case FILE:
			try {
				cfg.setTemplateLoader(new FileTemplateLoader(FileUtil.file(config.getPath())));
			} catch (IOException e) {
				throw new IORuntimeException(e);
			}
			break;
		case WEB_ROOT:
			 try {
				 cfg.setTemplateLoader(new FileTemplateLoader(FileUtil.file(FileUtil.getWebRoot(), config.getPath())));
			 } catch (IOException e) {
				 throw new IORuntimeException(e);
			 }
			break;
		case STRING:
			cfg.setTemplateLoader(new SimpleStringTemplateLoader());
			break;
		default:
			break;
		}
		
		return cfg;
	}
1167476
private OnDemandStatsProducer<PageInBrowserStats> createProducer(final String producerId, final String category, final String subsystem) {
		OnDemandStatsProducer<PageInBrowserStats> producer = limit == -1 ? new OnDemandStatsProducer<PageInBrowserStats>(producerId, category, subsystem, new PageInBrowserStatsFactory()) :
				new EntryCountLimitedOnDemandStatsProducer<PageInBrowserStats>(producerId, category, subsystem, new PageInBrowserStatsFactory(), limit);

		ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(producer);
		return producer;
	}
1312529
public <K, V> void produce(String topic, KafkaProducer<K, V> producer, Map<K, V> data) {
        data.forEach((k, v) -> producer.send(new ProducerRecord<>(topic, k, v)));
        producer.flush();
    }
210827
public static FixedDelayRestartStrategyFactory createFactory(Configuration configuration) throws Exception {
		int maxAttempts = configuration.getInteger(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS, 1);

		String delayString = configuration.getString(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY);

		long delay;

		try {
			delay = Duration.apply(delayString).toMillis();
		} catch (NumberFormatException nfe) {
			throw new Exception("Invalid config value for " +
					ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY + ": " + delayString +
					". Value must be a valid duration (such as '100 milli' or '10 s')");
		}

		return new FixedDelayRestartStrategyFactory(maxAttempts, delay);
	}
972769
public <T> TopicProducer<T> createTopicProducer(final String topic, final ProducerCallback<T> messageCallback)
    {
        Preconditions.checkState(connectionFactory != null, "connection factory was never injected!");
        return new TopicProducer<T>(connectionFactory, jmsConfig, topic, messageCallback);
    }