You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/05/04 23:12:54 UTC

[GitHub] [camel] iridian-ks opened a new pull request #5504: CAMEL-16577 add support to set the index time

iridian-ks opened a new pull request #5504:
URL: https://github.com/apache/camel/pull/5504


   <!-- Uncomment and fill this section if your PR is not trivial
   - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
   - [ ] Each commit in the pull request should have a meaningful subject line and body.
   - [ ] If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Run `mvn clean install -Psourcecheck` in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.
   Below are the contribution guidelines:
   https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   -->
   
   Add new option in the splunk-hec component in order to set the time the event occurred rather than defaulting the time to the index time.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus commented on pull request #5504: CAMEL-16577 add support to set the index time

Posted by GitBox <gi...@apache.org>.
davsclaus commented on pull request #5504:
URL: https://github.com/apache/camel/pull/5504#issuecomment-835227205


   Option2 is what other components would do.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus commented on a change in pull request #5504: CAMEL-16577 add support to set the index time

Posted by GitBox <gi...@apache.org>.
davsclaus commented on a change in pull request #5504:
URL: https://github.com/apache/camel/pull/5504#discussion_r632847089



##########
File path: components/camel-splunk-hec/src/main/java/org/apache/camel/component/splunkhec/SplunkHECProducer.java
##########
@@ -128,5 +131,25 @@ private void buildPayload(Map<String, Object> payload) {
         if (endpoint.getConfiguration().getHost() != null) {
             payload.put("host", endpoint.getConfiguration().getHost());
         }
+
+        Object timeInput = message.getHeader(SplunkHECComponent.INDEX_TIME, endpoint.getConfiguration().getTime());

Review comment:
       You should use Camel's type converter, and use getHeader where you can specify the returned time as Long so Camel deal with type conversions. Then all the code below can be removed




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] iridian-ks commented on a change in pull request #5504: CAMEL-16577 add support to set the index time

Posted by GitBox <gi...@apache.org>.
iridian-ks commented on a change in pull request #5504:
URL: https://github.com/apache/camel/pull/5504#discussion_r632860400



##########
File path: components/camel-splunk-hec/src/main/java/org/apache/camel/component/splunkhec/SplunkHECProducer.java
##########
@@ -128,5 +131,25 @@ private void buildPayload(Map<String, Object> payload) {
         if (endpoint.getConfiguration().getHost() != null) {
             payload.put("host", endpoint.getConfiguration().getHost());
         }
+
+        Object timeInput = message.getHeader(SplunkHECComponent.INDEX_TIME, endpoint.getConfiguration().getTime());

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] iridian-ks commented on pull request #5504: CAMEL-16577 add support to set the index time

Posted by GitBox <gi...@apache.org>.
iridian-ks commented on pull request #5504:
URL: https://github.com/apache/camel/pull/5504#issuecomment-834774434


   Thanks for the feedback!!!
   
   To be clear. What is the desired approach here?
   
   1. Header ONLY
   2. Header AND option and Header takes precedence
   3. Option AND header and Option takes precedence
   
   My initial idea was to use `.toD("${header.splunkTime}"). So, yes the header is pretty much always required when using this feature. Thank you for the time and guidance in this! :) 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] iridian-ks commented on pull request #5504: CAMEL-16577 add support to set the index time

Posted by GitBox <gi...@apache.org>.
iridian-ks commented on pull request #5504:
URL: https://github.com/apache/camel/pull/5504#issuecomment-841461561


   Thanks for the reminder @davsclaus 
   
   I pushed a new commit that adds support for the header as well as some update to the documentation. I am definitely still learning the ropes of best practices so feedback is welcomed!
   
   Thanks for your time on this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus commented on pull request #5504: CAMEL-16577 add support to set the index time

Posted by GitBox <gi...@apache.org>.
davsclaus commented on pull request #5504:
URL: https://github.com/apache/camel/pull/5504#issuecomment-841079392


   Do you have time to work on this, we are getting close to be ready for building the next release.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus merged pull request #5504: CAMEL-16577 add support to set the index time

Posted by GitBox <gi...@apache.org>.
davsclaus merged pull request #5504:
URL: https://github.com/apache/camel/pull/5504


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus commented on pull request #5504: CAMEL-16577 add support to set the index time

Posted by GitBox <gi...@apache.org>.
davsclaus commented on pull request #5504:
URL: https://github.com/apache/camel/pull/5504#issuecomment-832405795


   I wonder if you wont want to have a header with the time that can take precedence, instead of endpoint option. Endpoint options tend to be more static.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org